diff --git a/src/hlua.c b/src/hlua.c index 4ef5a8cf5..b826e6ab8 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -273,6 +273,7 @@ static const char *hlua_tostring_safe(lua_State *L, int index) break; default: /* error was caught */ + lua_pop(L, 1); // consume the lua object pushed on the stack since we ignore it return NULL; } return str; @@ -323,6 +324,7 @@ static const char *hlua_pushvfstring_safe(lua_State *L, const char *fmt, va_list break; default: /* error was caught */ + lua_pop(L, 1); // consume the lua object pushed on the stack since we ignore it dst = NULL; } va_end(cpy_argp); @@ -904,6 +906,7 @@ const char *hlua_traceback(lua_State *L, const char* sep) case LUA_OK: break; default: + lua_pop(L, 1); // consume the lua object pushed on the stack since we ignore it goto end; // abort } @@ -1002,6 +1005,7 @@ static int hlua_pusherror(lua_State *L, const char *fmt, ...) case LUA_OK: break; default: + lua_pop(L, 1); // consume the lua object pushed on the stack since we ignore it ret = 0; } @@ -10192,6 +10196,7 @@ static int hlua_new_event_sub_safe(lua_State *L, struct event_hdl_sub *sub) return 1; default: /* error was caught */ + lua_pop(L, 1); // consume the lua object pushed on the stack since we ignore it return 0; } }