Skip to content

Fix CTD with ship-percent sexp edge case - #7738

Merged
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
wookieejedi:fix-ctd-percent-ships-x
Aug 25, 2026
Merged

Fix CTD with ship-percent sexp edge case#7738
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
wookieejedi:fix-ctd-percent-ships-x

Conversation

@wookieejedi

Copy link
Copy Markdown
Member

sexp_percent_ships_arrive_depart_destroy_disarm_disable_scan could have an edge case where the total value (ie the denominator) is 0 and thus crashes FSO. This could happen if Cancel_future_waves_of_any_wing_launched_from_an_exited_ship is used and the death or departure of a mothership triggers the total of a wing to change that is later checked in a sexp such a 'percent-destroyed` or other similar sexps.

Fix is just to add an early out if the total value is 0.

`sexp_percent_ships_arrive_depart_destroy_disarm_disable_scan` could have an edge case where the total value (ie the denominator) is 0 and thus crashes FSO. This could happen if `Cancel_future_waves_of_any_wing_launched_from_an_exited_ship` is used and the death or departure of a mothership triggers the total of a wing to change that is later checked in a sexp such a 'percent-destroyed` or other similar sexps.

Fix is just to add an early out if the total value is 0.
@wookieejedi wookieejedi added this to the Release 26.0.1 milestone Aug 24, 2026
@wookieejedi wookieejedi added fix A fix for bugs, not-a-bugs, and/or regressions. sexps A feature or issue related to SEXPs Point Release Candidate An already merged bugfix that may be merged into a previous stable version labels Aug 24, 2026
@wookieejedi
wookieejedi merged commit e0e3e9d into scp-fs2open:master Aug 25, 2026
18 checks passed
@wookieejedi
wookieejedi deleted the fix-ctd-percent-ships-x branch August 25, 2026 19:11
wookieejedi added a commit that referenced this pull request Aug 25, 2026
`sexp_percent_ships_arrive_depart_destroy_disarm_disable_scan` could have an edge case where the total value (ie the denominator) is 0 and thus crashes FSO. This could happen if `Cancel_future_waves_of_any_wing_launched_from_an_exited_ship` is used and the death or departure of a mothership triggers the total of a wing to change that is later checked in a sexp such a 'percent-destroyed` or other similar sexps.

Fix is just to add an early out if the total value is 0.
@wookieejedi wookieejedi added added to point release and removed Point Release Candidate An already merged bugfix that may be merged into a previous stable version labels Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added to point release fix A fix for bugs, not-a-bugs, and/or regressions. sexps A feature or issue related to SEXPs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants