From 33a871024db8f7b06323a824a74d84e45effe568 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sat, 31 Jan 2026 20:54:15 +0000 Subject: [PATCH] Fix potential null pointer dereference in PartitionManager --- .../GameEngine/Source/GameLogic/Object/PartitionManager.cpp | 3 +++ .../GameEngine/Source/GameLogic/Object/PartitionManager.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 57bd9bca84..60f7bd4276 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3314,6 +3314,9 @@ Object *PartitionManager::getClosestObjects( for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = thisCoi->getNextCoi()) { PartitionData *thisMod = thisCoi->getModule(); + if (thisMod == nullptr) + continue; + Object *thisObj = thisMod->getObject(); // never compare against ourself. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 91b5ffb9e6..66d1169299 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3321,6 +3321,9 @@ Object *PartitionManager::getClosestObjects( for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = thisCoi->getNextCoi()) { PartitionData *thisMod = thisCoi->getModule(); + if (thisMod == nullptr) + continue; + Object *thisObj = thisMod->getObject(); // never compare against ourself.