diff --git a/ldo.c b/ldo.c index 7135079b12..b96c72beb3 100644 --- a/ldo.c +++ b/ldo.c @@ -113,7 +113,14 @@ void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { l_noret luaD_throw (lua_State *L, int errcode) { - if (L->errorJmp) { /* thread has an error handler? */ + if { /* no handler at all; abort */ + if (g->panic) { /* panic function? */ + lua_unlock(L); + g->panic(L); /* call panic function (last chance to jump out) */ + } + abort(); + } + else if (L->errorJmp) { /* thread has an error handler? */ L->errorJmp->status = errcode; /* set status */ LUAI_THROW(L, L->errorJmp); /* jump to it */ } @@ -124,13 +131,6 @@ l_noret luaD_throw (lua_State *L, int errcode) { setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ } - else { /* no handler at all; abort */ - if (g->panic) { /* panic function? */ - lua_unlock(L); - g->panic(L); /* call panic function (last chance to jump out) */ - } - abort(); - } } }