diff --git a/lapi.c b/lapi.c index d6aaf8a8..142baf6a 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.278 2017/12/06 18:08:03 roberto Exp roberto $ +** $Id: lapi.c,v 2.279 2017/12/08 17:28:25 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -980,6 +980,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, func = 0; else { StkId o = index2stack(L, errfunc); + api_check(L, ttisfunction(s2v(o)), "error handler must be a function"); func = savestack(L, o); } c.func = L->top - (nargs+1); /* function to be called */ diff --git a/ldebug.c b/ldebug.c index 52335600..3ea6367f 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 2.150 2017/12/20 14:58:05 roberto Exp roberto $ +** $Id: ldebug.c,v 2.151 2017/12/28 15:42:57 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -722,10 +722,10 @@ const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, l_noret luaG_errormsg (lua_State *L) { if (L->errfunc != 0) { /* is there an error handling function? */ StkId errfunc = restorestack(L, L->errfunc); + lua_assert(ttisfunction(s2v(errfunc))); setobjs2s(L, L->top, L->top - 1); /* move argument */ setobjs2s(L, L->top - 1, errfunc); /* push function */ L->top++; /* assume EXTRA_STACK */ - luaE_incCcalls(L); luaD_callnoyield(L, L->top - 2, 1); /* call it */ } luaD_throw(L, LUA_ERRRUN);