mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
HPChange Reason: Fix push after free, and type being overwritten (#8359)
* HPChange Reason: Fix push after free, and type being overwritten Fixes #8227 and #8344
This commit is contained in:
@@ -257,6 +257,9 @@ int ObjectRef::l_set_hp(lua_State *L)
|
||||
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason);
|
||||
|
||||
if (reason.hasLuaReference())
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, reason.lua_reference);
|
||||
|
||||
// Return
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user