Gracefully handle lua_error() for a suspended coroutine.

Thanks to Sergei Zhirikov.
This commit is contained in:
Mike Pall 2014-12-15 01:55:45 +01:00
parent 6fddb9bc2e
commit c6e69249dd

View File

@ -499,8 +499,7 @@ static ptrdiff_t finderrfunc(lua_State *L)
{ {
cTValue *frame = L->base-1, *bot = tvref(L->stack); cTValue *frame = L->base-1, *bot = tvref(L->stack);
void *cf = L->cframe; void *cf = L->cframe;
while (frame > bot) { while (frame > bot && cf) {
lua_assert(cf != NULL);
while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */ while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */
if (frame >= restorestack(L, -cframe_nres(cf))) if (frame >= restorestack(L, -cframe_nres(cf)))
break; break;