lua: do not crash on syntax error in debug.debug()

This commit is contained in:
Björn Linse
2019-08-04 19:42:31 +02:00
parent d3a7bdefb0
commit e6d77993d1
2 changed files with 77 additions and 3 deletions

View File

@@ -449,11 +449,10 @@ int nlua_debug(lua_State *lstate)
if (luaL_loadbuffer(lstate, (const char *)input.vval.v_string,
STRLEN(input.vval.v_string), "=(debug command)")) {
nlua_error(lstate, _("E5115: Error while loading debug string: %.*s"));
}
tv_clear(&input);
if (lua_pcall(lstate, 0, 0, 0)) {
} else if (lua_pcall(lstate, 0, 0, 0)) {
nlua_error(lstate, _("E5116: Error while calling debug string: %.*s"));
}
tv_clear(&input);
}
return 0;
}