diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 5026e30be..6fc0d5d8b 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -2796,6 +2796,11 @@ static int _hlua_patref_add_bulk(lua_State *L, int status, lua_KContext ctx) int count = 0; int ret; + if (!lua_istable(L, 2)) { + luaL_argerror(L, 2, "argument is expected to be a table"); + return 0; // not reached + } + if ((ref->flags & HLUA_PATREF_FL_GEN) && pat_ref_may_commit(ref->ptr, ref->curr_gen)) curr_gen = ref->curr_gen;