aboutsummaryrefslogtreecommitdiff
path: root/src/lj_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_debug.c')
-rw-r--r--src/lj_debug.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 85dbac50..d5693779 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -401,10 +401,14 @@ void lj_debug_pushloc(lua_State *L, GCproto *pt, BCPos pc)
401LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n) 401LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n)
402{ 402{
403 const char *name = NULL; 403 const char *name = NULL;
404 TValue *o = debug_localname(L, ar, &name, (BCReg)n); 404 if (ar) {
405 if (name) { 405 TValue *o = debug_localname(L, ar, &name, (BCReg)n);
406 copyTV(L, L->top, o); 406 if (name) {
407 incr_top(L); 407 copyTV(L, L->top, o);
408 incr_top(L);
409 }
410 } else if (tvisfunc(L->top-1) && isluafunc(funcV(L->top-1))) {
411 name = debug_varname(funcproto(funcV(L->top-1)), 0, (BCReg)n-1);
408 } 412 }
409 return name; 413 return name;
410} 414}