Skip to content

Mod Menu: Fix empty list crash#6015

Merged
serprex merged 1 commit intoHarbourMasters:develop-copperfrom
ShishuTheDragon:fix-modmenu-empty-crash
Jan 1, 2026
Merged

Mod Menu: Fix empty list crash#6015
serprex merged 1 commit intoHarbourMasters:develop-copperfrom
ShishuTheDragon:fix-modmenu-empty-crash

Conversation

@ShishuTheDragon
Copy link
Contributor

@ShishuTheDragon ShishuTheDragon commented Dec 11, 2025

This pull request fixes a minor crash in Copper Bravo (9.1.1).

Steps to reproduce:

  1. Ensure your mods folder is empty.
  2. Open the Mod Menu.
  3. Click Edit.
  4. Click Cancel.

Video:

Cause:
When there are no mods installed, CVAR_ENABLED_MODS_VALUE is an empty string. As such, line 99 evaluates to a list containing one empty string, i.e. { "" }.

When starting the game, line 169 removes any mods from this list that can’t be found in the filesystem (e.g. have been uninstalled), which incidentally removes the "" from the list.

But when clicking Edit and then Cancel, line 99 is executed but line 169 is not. As a result, the enabledModFiles variable remains a list containing one empty string. Somewhere down the line when rendering the UI, this causes an out of range error.

Fix:
If CVAR_ENABLED_MODS_VALUE is an empty string, then GetEnabledModsFromCVar should just return an empty list. This seems most likely to be the “intended” behaviour; the removal logic on 169 was likely obscuring this error before.

Build Artifacts

@Malkierian
Copy link
Contributor

This does make sense, but I'd also like it to just not allow editing if the list is empty, since it just doesn't makes sense to edit an empty list in the first place.

@serprex serprex requested a review from Malkierian December 31, 2025 01:44
@serprex serprex merged commit d62e810 into HarbourMasters:develop-copper Jan 1, 2026
6 checks passed
@ShishuTheDragon ShishuTheDragon deleted the fix-modmenu-empty-crash branch January 18, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants