From 20d42ccaaed9a84783d548d76633a5a38f0091f1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 20 Sep 2024 15:56:39 -0300 Subject: No errors in 'luaO_pushvfstring' Any call to 'va_start' must have a corresponding call to 'va_end'; so, functions called between them (luaO_pushvfstring in particular) cannot raise errors. --- ldebug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 9e341f11..d1b47c56 100644 --- a/ldebug.c +++ b/ldebug.c @@ -847,7 +847,8 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { va_start(argp, fmt); msg = luaO_pushvfstring(L, fmt, argp); /* format message */ va_end(argp); - if (isLua(ci)) { /* if Lua function, add source:line information */ + if (msg != NULL && isLua(ci)) { /* Lua function? (and no error) */ + /* add source:line information */ luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */ L->top.p--; -- cgit v1.2.3-55-g6feb