diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-11-19 22:40:30 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-11-19 22:40:30 +0000 |
commit | 0f23c0b4910410c37dbbd8303e62695083cd0e53 (patch) | |
tree | e127a4c05aace743955fa14e2bf98b4bd218c401 | |
parent | 5785bdb7b6f7ef94c49b62c35f0af78acf4c9661 (diff) | |
download | prosody-0f23c0b4910410c37dbbd8303e62695083cd0e53.tar.gz prosody-0f23c0b4910410c37dbbd8303e62695083cd0e53.zip |
util.debug: Fix potential traceback
-rw-r--r-- | util/debug.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/util/debug.lua b/util/debug.lua index 0f0e24c0..22d02bf2 100644 --- a/util/debug.lua +++ b/util/debug.lua @@ -20,10 +20,12 @@ end local function get_upvalues_table(func) local upvalues = {}; - for upvalue_num = 1, math.huge do - local name, value = debug.getupvalue(func, upvalue_num); - if not name then break; end - table.insert(upvalues, { name = name, value = value }); + if func then + for upvalue_num = 1, math.huge do + local name, value = debug.getupvalue(func, upvalue_num); + if not name then break; end + table.insert(upvalues, { name = name, value = value }); + end end return upvalues; end |