From 3496d5cac56e52c125ff84ae89de41f164592fab Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 8 Nov 2023 15:34:40 +1100 Subject: [PATCH] - Exhumed: Return early in `movesprite()` if the actor's sector is null. * This is what PowerSlaveGDX does. * Fixes #1010. --- source/games/exhumed/src/move.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index f3a426c1ad..be29873eaf 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -421,17 +421,21 @@ Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flo auto spos = pActor->spr.pos; double nSpriteHeight = GetActorHeight(pActor); auto pSector = pActor->sector(); - assert(pSector); + Collision nRet{}; - double floorZ = pSector->floorz; + if (!pSector) + { + assert(pSector); + return nRet; + } - if ((pSector->Flag & kSectUnderwater) || (floorZ < spos.Z)) + if ((pSector->Flag & kSectUnderwater) || (pSector->floorz < spos.Z)) { vect *= 0.5; } sectortype* overridesect; - Collision nRet = movespritez(pActor, dz, nSpriteHeight, pActor->clipdist, &overridesect); + nRet = movespritez(pActor, dz, nSpriteHeight, pActor->clipdist, &overridesect); pSector = pActor->sector(); // modified in movespritez so re-grab this variable