Skip to content

Commit 75a3a4b

Browse files
authored
[GEN][ZH] Suppress compiler warning about dereferencing NULL pointer 'builderObj' in PlaceEventTranslator::translateGameMessage() (#1106)
1 parent 8698229 commit 75a3a4b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
170170
// translate the screen position of start to world target location
171171
TheTacticalView->screenToTerrain( &anchorStart, &world );
172172

173-
// get the source object ID of the thing that is "building" the object
174-
ObjectID builderID = INVALID_ID;
175173
Object *builderObj = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() );
176-
if( builderObj )
177-
builderID = builderObj->getID();
178174

179175
//Kris: September 27, 2002
180176
//Make sure we have enough CASH to build it! It's possible that between the
@@ -209,6 +205,8 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
209205
break;
210206
}
211207

208+
DEBUG_ASSERTCRASH(builderObj != NULL, ("builderObj is NULL"));
209+
212210
// check to see if this is a legal location to build something at
213211
LegalBuildCode lbc;
214212
lbc = TheBuildAssistant->isLocationLegalToBuild( &world,

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
181181
// translate the screen position of start to world target location
182182
TheTacticalView->screenToTerrain( &anchorStart, &world );
183183

184-
// get the source object ID of the thing that is "building" the object
185-
ObjectID builderID = INVALID_ID;
186184
Object *builderObj = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() );
187-
if( builderObj )
188-
builderID = builderObj->getID();
189185

190186
//Kris: September 27, 2002
191187
//Make sure we have enough CASH to build it! It's possible that between the
@@ -220,6 +216,8 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
220216
break;
221217
}
222218

219+
DEBUG_ASSERTCRASH(builderObj != NULL, ("builderObj is NULL"));
220+
223221
// check to see if this is a legal location to build something at
224222
LegalBuildCode lbc;
225223
lbc = TheBuildAssistant->isLocationLegalToBuild( &world,

0 commit comments

Comments
 (0)