diff options
-rw-r--r-- | src/lj_err.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_err.c b/src/lj_err.c index 7db37f3b..3570ebde 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -96,6 +96,8 @@ static BCPos currentpc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
96 | if (!isluafunc(fn)) { /* Cannot derive a PC for non-Lua functions. */ | 96 | if (!isluafunc(fn)) { /* Cannot derive a PC for non-Lua functions. */ |
97 | return ~(BCPos)0; | 97 | return ~(BCPos)0; |
98 | } else if (nextframe == NULL) { /* Lua function on top. */ | 98 | } else if (nextframe == NULL) { /* Lua function on top. */ |
99 | if (L->cframe == NULL) | ||
100 | return ~(BCPos)0; | ||
99 | ins = cframe_Lpc(L); /* Only happens during error/hook handling. */ | 101 | ins = cframe_Lpc(L); /* Only happens during error/hook handling. */ |
100 | } else { | 102 | } else { |
101 | if (frame_islua(nextframe)) { | 103 | if (frame_islua(nextframe)) { |
@@ -106,6 +108,8 @@ static BCPos currentpc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
106 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ | 108 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ |
107 | void *cf = cframe_raw(L->cframe); | 109 | void *cf = cframe_raw(L->cframe); |
108 | TValue *f = L->base-1; | 110 | TValue *f = L->base-1; |
111 | if (cf == NULL) | ||
112 | return ~(BCPos)0; | ||
109 | while (f > nextframe) { | 113 | while (f > nextframe) { |
110 | if (frame_islua(f)) { | 114 | if (frame_islua(f)) { |
111 | f = frame_prevl(f); | 115 | f = frame_prevl(f); |