From d330e2c8aeb7c7951b81c87e35ecadb8158a99c7 Mon Sep 17 00:00:00 2001 From: Wall <90075138+Wall-core@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:50:25 -0500 Subject: [PATCH] Crashfix with underwater giant NavMesh Fixes a dereferenced null pointer --- src/game/Objects/Object.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 09737b29f86..622fc26eb8e 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -1952,9 +1952,12 @@ bool WorldObject::GetRandomPoint(float x, float y, float z, float distance, floa rand_z = z; if (pMap->GetWalkRandomPosition(GetTransport(), rand_x, rand_y, rand_z, distance, moveAllowed)) { - // Giant type creatures walk underwater - if ((pUnit && !pUnit->CanSwim()) || - (IsCreature() && !pUnit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_USE_SWIM_ANIMATION))) + // Can't swim, so walk + if ((pUnit && !pUnit->CanSwim())) + return true; + + // Giant type creatures lack USE_SWIM_ANIMATION flag, and walk underwater + if (pUnit && pUnit->IsCreature() && !pUnit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_USE_SWIM_ANIMATION)) return true; // The position returned by the pathfinding is at the bottom of the water. We're randomizing it a bit...