Software /
code /
prosody
Diff
util/debug.lua @ 4418:70b5e533325d
util.debug: Fix potential traceback
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 Nov 2011 22:40:30 +0000 |
parent | 4412:5d7d9a60bc7f |
child | 4465:41c4252526bd |
line wrap: on
line diff
--- a/util/debug.lua Sat Nov 19 21:12:23 2011 +0500 +++ b/util/debug.lua Sat Nov 19 22:40:30 2011 +0000 @@ -20,10 +20,12 @@ 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