diff options
author | Mike Pall <mike> | 2014-12-15 01:55:45 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2014-12-15 01:55:45 +0100 |
commit | c6e69249ddc69523eaa0c88f68c6f816a30b537c (patch) | |
tree | 903fd10cf299eab51fb6c2f0383dc585fe5105bb | |
parent | 6fddb9bc2e9e85a89aa229538103f1bd80d6b5be (diff) | |
download | luajit-c6e69249ddc69523eaa0c88f68c6f816a30b537c.tar.gz luajit-c6e69249ddc69523eaa0c88f68c6f816a30b537c.tar.bz2 luajit-c6e69249ddc69523eaa0c88f68c6f816a30b537c.zip |
Gracefully handle lua_error() for a suspended coroutine.
Thanks to Sergei Zhirikov.
-rw-r--r-- | src/lj_err.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lj_err.c b/src/lj_err.c index 3097795c..8010221f 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -499,8 +499,7 @@ static ptrdiff_t finderrfunc(lua_State *L) | |||
499 | { | 499 | { |
500 | cTValue *frame = L->base-1, *bot = tvref(L->stack); | 500 | cTValue *frame = L->base-1, *bot = tvref(L->stack); |
501 | void *cf = L->cframe; | 501 | void *cf = L->cframe; |
502 | while (frame > bot) { | 502 | while (frame > bot && cf) { |
503 | lua_assert(cf != NULL); | ||
504 | while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */ | 503 | while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */ |
505 | if (frame >= restorestack(L, -cframe_nres(cf))) | 504 | if (frame >= restorestack(L, -cframe_nres(cf))) |
506 | break; | 505 | break; |