Fix #8737: Added Safeguard for Missing Game Options When Saving Older Campaigns#9091
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9091 +/- ##
============================================
+ Coverage 15.19% 15.23% +0.03%
- Complexity 9273 9310 +37
============================================
Files 1302 1304 +2
Lines 172400 172523 +123
Branches 26046 26063 +17
============================================
+ Hits 26204 26281 +77
- Misses 143151 143198 +47
+ Partials 3045 3044 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
|
From what I recall, we might have seen this when a campaign contained game options that were no longer supported, or when the campaign's options did not contain a value that was now required (due to a recent change in the nightly builds, say). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #8737
Under rare circumstances it seems that a campaign can end up with malformed MegaMek Game Options.
nullto be precise. This then prevents saving, because the saving process assumesGameOptionshas been substantiated.I've explored the campaign creation process and I cannot find any explanation why campaigns are instantiating with
null GameOptions. It shouldn't be possible.Clearly that isn't the case, so what I've gone ahead and done is added a catch that will self-correct in the event a
null GameOptionis detected during the save process. The player will be notified when this occurs.