Skip to content

Commit 1a785ff

Browse files
authored
[GEN][ZH] Fix crash within Team::killTeam() caused by the neutral player having no player template (#1221)
1 parent 4c69156 commit 1a785ff

File tree

2 files changed

+6
-2
lines changed
  • GeneralsMD/Code/GameEngine/Source/Common/RTS
  • Generals/Code/GameEngine/Source/Common/RTS

2 files changed

+6
-2
lines changed

Generals/Code/GameEngine/Source/Common/RTS/Team.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2430,8 +2430,10 @@ void Team::killTeam(void)
24302430

24312431
evacuateTeam();
24322432

2433+
// TheSuperHackers @bugfix Mauller 20/07/2025 the neutral player has no player template so we need to check for a null template
2434+
const PlayerTemplate* playerTemplate = getControllingPlayer()->getPlayerTemplate();
24332435
// beacons are effectively dead, so we need to destroy via a non-kill() method
2434-
const ThingTemplate *beaconTemplate = TheThingFactory->findTemplate( getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() );
2436+
const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : NULL;
24352437

24362438
// now find objects to kill
24372439
for (DLINK_ITERATOR<Object> iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) {

GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2436,8 +2436,10 @@ void Team::killTeam(void)
24362436

24372437
evacuateTeam();
24382438

2439+
// TheSuperHackers @bugfix Mauller 20/07/2025 the neutral player has no player template so we need to check for a null template
2440+
const PlayerTemplate* playerTemplate = getControllingPlayer()->getPlayerTemplate();
24392441
// beacons are effectively dead, so we need to destroy via a non-kill() method
2440-
const ThingTemplate *beaconTemplate = TheThingFactory->findTemplate( getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() );
2442+
const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : NULL;
24412443

24422444
// now find objects to kill
24432445
for (DLINK_ITERATOR<Object> iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) {

0 commit comments

Comments
 (0)