Fix dereferncing Broly null pointer

This commit is contained in:
James R 2023-12-23 00:25:19 -08:00
parent c8827c18a2
commit 98c4b34530
2 changed files with 9 additions and 2 deletions

View file

@ -875,8 +875,10 @@ boolean K_InstaWhipCollide(mobj_t *shield, mobj_t *victim)
attackerPlayer->flashing = 0;
// Localized broly for a local event.
mobj_t *broly = Obj_SpawnBrolyKi(victim, victimHitlag);
broly->extravalue2 = 16*mapobjectscale;
if (mobj_t *broly = Obj_SpawnBrolyKi(victim, victimHitlag))
{
broly->extravalue2 = 16*mapobjectscale;
}
P_PlayVictorySound(victim);

View file

@ -22,6 +22,11 @@ Obj_SpawnBrolyKi
{
Broly* x = Broly::spawn<Broly>(static_cast<Mobj*>(source), duration, {64 * mapobjectscale, 0});
if (!x)
{
return nullptr;
}
x->colorized = true;
x->color = source->color;