Fix SetMaxHP crashing if spawn ptr is invalid

This commit is contained in:
Emagi 2022-11-17 10:36:45 -05:00
parent 31e13d5c58
commit 269cb74202

View file

@ -2016,7 +2016,7 @@ int EQ2Emu_lua_SetMaxHP(lua_State* state) {
if (spawn && spawn->IsEntity() && value > 0)
((Entity*)spawn)->AddSpellBonus(0, ITEM_STAT_HEALTH, value - spawn->GetTotalHP());
if (spawn->IsPlayer())
if (spawn && spawn->IsPlayer())
((Player*)spawn)->SetCharSheetChanged(true);
return 0;