Skip to content

Commit

Permalink
Merge pull request scp-fs2open#5907 from asarium/fix/balanceLuaStack
Browse files Browse the repository at this point in the history
Fix unbalanced stack when retrieving Lua main thread
  • Loading branch information
asarium committed Dec 31, 2023
2 parents b3df336 + b8da110 commit 202686d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/scripting/lua/LuaUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ lua_State* getMainThread(lua_State* L)
lua_rawget(L, LUA_REGISTRYINDEX);

auto state = lua_tothread(L, -1);
lua_pop(L, 1);

// Need to pop both the thread from L and the main thread to return the stack back to neutral
lua_pop(L, 2);

return state;
}
Expand Down

0 comments on commit 202686d

Please sign in to comment.