diff options
author | Mike Pall <mike> | 2010-03-07 18:21:14 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-03-07 18:21:14 +0100 |
commit | f354b46d296acb8a5fab89a0314a81ba72925d68 (patch) | |
tree | 66e30e348dec9792d782842c491f554949e54ddc /src | |
parent | 9fd1c6c586df3feeed67eb919d4cf06def46fced (diff) | |
download | luajit-f354b46d296acb8a5fab89a0314a81ba72925d68.tar.gz luajit-f354b46d296acb8a5fab89a0314a81ba72925d68.tar.bz2 luajit-f354b46d296acb8a5fab89a0314a81ba72925d68.zip |
Fix tracebacks for failed coroutines.
Diffstat (limited to 'src')
-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); |