Skip to content

Guard settings apply without a loaded game#16

Closed
Sean-Kenneth-Doherty wants to merge 2 commits into
gotmachine:masterfrom
Sean-Kenneth-Doherty:fix-settings-build-refs
Closed

Guard settings apply without a loaded game#16
Sean-Kenneth-Doherty wants to merge 2 commits into
gotmachine:masterfrom
Sean-Kenneth-Doherty:fix-settings-build-refs

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty commented May 17, 2026

Summary

Why

Issue #2 reports NullReferenceException from MandatoryRCSSettings.ApplySettings() when KSP's settings screen applies changes from the main menu. In that path there is no loaded save, so HighLogic.CurrentGame is null before the method reads custom game parameters.

Validation

  • Confirmed issue NRE when changing general settings in the main menu #2's stack points to ApplySettings() through OnGameSettingsApplied() from the main menu settings screen.
  • Static source check: every later read in ApplySettings() goes through HighLogic.CurrentGame.Parameters, so returning when HighLogic.CurrentGame is null avoids only the no-save main-menu path.
  • Direct source compile with local KSP 1.12.5.3190 managed assemblies using mcs; compile succeeded with two pre-existing unused-field warnings.
  • git diff --check HEAD~2..HEAD -- MandatoryRCS-Source/MandatoryRCSSettings.cs

Notes

  • This PR is intentionally narrowed to one source change in MandatoryRCSSettings.cs.
  • It does not change the packaged DLL, build files, assembly version, AVC metadata, or declared KSP compatibility range.
  • I have not run an in-game runtime pass.

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty changed the title Guard settings apply and modernize build refs Guard settings apply without a loaded game May 18, 2026
@Sean-Kenneth-Doherty
Copy link
Copy Markdown
Author

Closing this under my tightened quality bar rather than leaving an unproven settings-lifecycle draft in your queue. The branch fixes a plausible main-menu settings null path and compiles locally, but the affected in-game/main-menu settings behavior was not runtime-tested in KSP. I will not reopen unless you want this exact fix or there is a concrete player-facing defect with proof.

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.

1 participant