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 Christoph Oelckers
parent 7e4a996cd4
commit b8bf812433

View file

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