Skip to content

Commit

Permalink
lua/Close: check the lua_getmetatable() return value
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Dec 5, 2023
1 parent 5aa41ae commit a05eebf
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lua/Close.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ Close(lua_State *L, AnyStackIndex auto idx)
{
const ScopeCheckStack check_stack{L};

lua_getmetatable(L, GetStackIndex(idx));
if (!lua_istable(L, -1)) {
/* pop nil */
lua_pop(L, 1);
if (!lua_getmetatable(L, GetStackIndex(idx)))
return false;
}

lua_getfield(L, -1, "__close");
if (!lua_isfunction(L, -1)) {
Expand Down

0 comments on commit a05eebf

Please sign in to comment.