Obj_SuperFlickyOwner: check valid before returning source

- Flicky::source() dereferences a pointer
This commit is contained in:
James R 2023-11-14 01:05:04 -08:00
parent 469c85377d
commit cbe42f969b

View file

@ -765,7 +765,7 @@ mobj_t *Obj_SuperFlickyOwner(const mobj_t* mobj)
{
const Flicky* x = static_cast<const Flicky*>(mobj);
return x->source();
return x->valid() ? x->source() : nullptr;
}
boolean Obj_IsSuperFlickyWhippable(const mobj_t* mobj)
@ -780,4 +780,4 @@ boolean Obj_IsSuperFlickyTargettingYou(const mobj_t* mobj, mobj_t *player)
const Flicky* x = static_cast<const Flicky*>(mobj);
return player == x->chasing();
}
}