Fix obscure error in Animated Doors where the Actor can be NULL

This is a quick fix for an error in which Animated Doors crash the game by trying to check "actor->player" when "actor" itself is NULL.  Deleting the check entirely also worked, but I worried it might be there for some higher-level scripting reason.  This just puts in a check to make sure actor isn't NULL before checking actor->player, and keeps the behavior in that case the same.

I think this was happening because I had doors being opened by projectiles (like in Metroid) which were being despawned into NULL pointers when they hit the doors, as this was an issue when initially programming said doors..
This commit is contained in:
RockstarRaccoonAlt 2020-08-14 22:42:59 -05:00 committed by drfrag
parent 3d22c635f4
commit 2c3303e723

View file

@ -770,7 +770,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay,
// Make sure door isn't already being animated
if (sec->ceilingdata != NULL )
{
if (actor->player == NULL)
if (actor == NULL || actor->player == NULL)
return false;
if (sec->ceilingdata->IsA (RUNTIME_CLASS(DAnimatedDoor)))