Skip to content

Commit 6a9f390

Browse files
committed
Added check to see whether the bike still has a rider.
1 parent b8d95a4 commit 6a9f390

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,19 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo )
405405
}
406406
else
407407
{
408-
//Removing the rider will scuttle the bike.
409-
Object *rider = *(contain->getContainedItemsList()->begin());
410-
ai->aiEvacuateInstantly( TRUE, CMD_FROM_AI );
408+
// TheSuperHackers @bugfix Caball009 04/09/2025 Check whether a bike still has a rider.
409+
// A rider may dismount or be sniped off a bike when it's disabled, resulting in a bike object with an empty contain list.
410+
if ( !contain->getContainedItemsList()->empty() )
411+
{
412+
//Removing the rider will scuttle the bike.
413+
Object* rider = *(contain->getContainedItemsList()->begin());
414+
ai->aiEvacuateInstantly(TRUE, CMD_FROM_AI);
411415

412-
//Kill the rider.
413-
if (damager)
414-
damager->scoreTheKill( rider );
415-
rider->kill();
416+
//Kill the rider.
417+
if (damager)
418+
damager->scoreTheKill(rider);
419+
rider->kill();
420+
}
416421
}
417422
}
418423
else

0 commit comments

Comments
 (0)