Fixed nullptr dereference in void CommonEnterCombatModeCode( ) & added two nullptr safety checks

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9393 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Asdow
2022-08-02 22:29:00 +00:00
parent 9f0a3e03bb
commit f733bda830
2 changed files with 5 additions and 9 deletions
+2 -2
View File
@@ -6428,7 +6428,7 @@ void CommonEnterCombatModeCode( )
// Loop through all mercs and make go
for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, ++cnt )
{
if ( pSoldier->bActive )
if ( pSoldier && pSoldier->bActive )
{
if ( pSoldier->bInSector && pSoldier->ubBodyType != CROW )
{
@@ -6440,7 +6440,7 @@ void CommonEnterCombatModeCode( )
pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection );
// END AI actions
DebugAI(AI_MSG_INFO, MercPtrs[pSoldier->ubAutoBandagingMedic], String("CancelAIAction: enter combat mode"));
DebugAI(AI_MSG_INFO, pSoldier, String("CancelAIAction: enter combat mode"));
CancelAIAction( pSoldier, TRUE );
// turn off AI controlled flag