Skip to content

Commit 0bef4c9

Browse files
authored
[GEN][ZH] Fix crash when exiting Replay playback while a player places a beacon (2) (#972)
1 parent de85be4 commit 0bef4c9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,8 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
15771577
// --------------------------------------------------------------------------------------------
15781578
case GameMessage::MSG_PLACE_BEACON:
15791579
{
1580-
// how many does this player have active?
1580+
if (thisPlayer->getPlayerTemplate() == NULL)
1581+
break;
15811582
Coord3D pos = msg->getArgument( 0 )->location;
15821583
Region3D r;
15831584
TheTerrainLogic->getExtent(&r);
@@ -1586,6 +1587,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
15861587
const ThingTemplate *thing = TheThingFactory->findTemplate( thisPlayer->getPlayerTemplate()->getBeaconTemplate() );
15871588
if (thing && !TheVictoryConditions->hasSinglePlayerBeenDefeated(thisPlayer))
15881589
{
1590+
// how many does this player have active?
15891591
Int count;
15901592
thisPlayer->countObjectsByThingTemplate( 1, &thing, false, &count );
15911593
DEBUG_LOG(("Player already has %d beacons active\n", count));

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,8 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
16051605
// --------------------------------------------------------------------------------------------
16061606
case GameMessage::MSG_PLACE_BEACON:
16071607
{
1608-
// how many does this player have active?
1608+
if (thisPlayer->getPlayerTemplate() == NULL)
1609+
break;
16091610
Coord3D pos = msg->getArgument( 0 )->location;
16101611
Region3D r;
16111612
TheTerrainLogic->getExtent(&r);
@@ -1614,6 +1615,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
16141615
const ThingTemplate *thing = TheThingFactory->findTemplate( thisPlayer->getPlayerTemplate()->getBeaconTemplate() );
16151616
if (thing && !TheVictoryConditions->hasSinglePlayerBeenDefeated(thisPlayer))
16161617
{
1618+
// how many does this player have active?
16171619
Int count;
16181620
thisPlayer->countObjectsByThingTemplate( 1, &thing, false, &count );
16191621
DEBUG_LOG(("Player already has %d beacons active\n", count));

0 commit comments

Comments
 (0)