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 | f64aa48b0f869bfd05272715264d41328bb8ae81 (patch) | |
tree | e127a4c05aace743955fa14e2bf98b4bd218c401 | |
parent | 54aa5182e966f6fdb11b47a2a13b006e9aff6dfd (diff) | |
download | prosody-f64aa48b0f869bfd05272715264d41328bb8ae81.tar.gz prosody-f64aa48b0f869bfd05272715264d41328bb8ae81.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 |