From 01c316108144ad0f5c84939c6b4ddc83de9ee652 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 31 May 2025 20:21:35 +0200 Subject: [PATCH] [GEN][ZH] Fix game crash in AIGroup::friend_moveFormationToPos() --- Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp | 5 +++++ GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index ac62c1bf42a..ad12247a65f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -1089,6 +1089,11 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c } Object *theUnit = (*i); AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); + if (ai == NULL) + { + continue; + } + Bool isDifferentFormation = false; Coord2D offset; if (isDifferentFormation) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index cf671acced3..a793feceb3f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -1094,6 +1094,11 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c } Object *theUnit = (*i); AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); + if (ai == NULL) + { + continue; + } + Bool isDifferentFormation = false; Coord2D offset; if (isDifferentFormation) {