mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
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:
@@ -6106,16 +6106,12 @@ BOOLEAN HandleMultiSelectionMove( INT32 sDestGridNo )
|
||||
|
||||
void ResetMultiSelection( )
|
||||
{
|
||||
SOLDIERTYPE * pSoldier;
|
||||
INT32 cnt;
|
||||
|
||||
// OK, loop through all guys who are 'multi-selected' and
|
||||
// Make them move....
|
||||
|
||||
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ )
|
||||
INT32 cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||
for (SOLDIERTYPE* pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ )
|
||||
{
|
||||
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||
if ( pSoldier && pSoldier->bActive && pSoldier->bInSector )
|
||||
{
|
||||
if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user