Skip to content

Conversation

@Caball009
Copy link

Brought to my attention by @MrS-ibra

This PR fixes a crash caused by accessing the first element of an empty list. This bug happens when you use Jarmen Kell to snipe an empty bike. Normally, empty (enemy) bikes are immediately destroyed, but disabled bikes can be empty for as long as they're disabled.

Bug reproduction:

  1. Disable an enemy bike, for instance with Black Lotus. Keep the bike disabled for all steps.
  2. Dismount the rider from the disabled bike (or use Jarmen Kell to snipe the rider from the bike).
  3. Use Jarmen Kell to snipe the now empty bike.
  4. The game crashes here:
    //Removing the rider will scuttle the bike.
    Object *rider = *(contain->getContainedItemsList()->begin());

PS: It probably shouldn't be possible to dismount from a disabled bike, but that's outside the scope of this PR.

@Caball009 Caball009 added GLA Affects GLA faction Major Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour Crash This is a crash, very bad labels Sep 4, 2025
@Caball009
Copy link
Author

Caball009 commented Sep 4, 2025

This could be fixed differently if we decide that empty (enemy) bikes should be scuttled immediately even when they're disabled.

@Caball009 Caball009 added the Bug Something is not working right, typically is user facing label Sep 4, 2025
@xezon xezon added the Approved Pull Request was approved label Oct 21, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be replicated to Generals.

Nevermind, Generals does not have bikes.

@xezon xezon removed the Bug Something is not working right, typically is user facing label Oct 25, 2025
@xezon xezon added this to the Major bug fixes milestone Oct 25, 2025
@xezon xezon changed the title bugfix(object): Check whether a bike still has a rider before sniping the rider. bugfix(object): Check whether a bike still has a rider before sniping it to prevent crashing the game Oct 25, 2025
@xezon xezon merged commit b620e21 into TheSuperHackers:main Oct 25, 2025
13 checks passed
@Caball009 Caball009 deleted the fix_crash_disabled_bike_snipe branch October 25, 2025 13:42
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Pull Request was approved Crash This is a crash, very bad GLA Affects GLA faction Major Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants