# HG changeset patch # User Mikael Berthe # Date 1275403309 -7200 # Node ID 99477d3c2dda17a7384e7d30fb5b8cbe6fe063a4 # Parent 5c0a2db896f5c57210840e6f4e0f3385333a817e Fix case where dict doesn't return anything diff -r 5c0a2db896f5 -r 99477d3c2dda mcbot/cmds/dict.lua --- a/mcbot/cmds/dict.lua Sun May 16 13:43:31 2010 +0200 +++ b/mcbot/cmds/dict.lua Tue Jun 01 16:41:49 2010 +0200 @@ -11,7 +11,7 @@ local fh = io.popen(cmd) result = fh:read("*a") -- read dict output fh:close() - if result:match("^$") then return nil, "dict: No output" end + if not result or result:match("^$") then return nil, "dict: No output" end -- Sometimes dict outpur is ugly... Let's filter out whitespace. result = result:gsub("[ \t]+\n", "\n"):gsub("\n\n\n+", "\n\n")