Fix exception at startup w/o default game inst #3863
Merged
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.
Problems
If you have multiple game instances and no default game instance, the Manage Game Instances window appears at startup. In v1.33.0, this exception is thrown after you select an instance:
There's also a "Check for updates" prompt that will happen every time.
(Everything works fine if "Set as default" is checked for some instance.)
Initially reported by a Discord who prefers to remain anonymous, then Poppa Wheelie on the forum.
Causes
As of #3829, when you have no default instance, we use
GUIConfiguration
's constructor to get the window geometry defaults from an instance of the class that doesn't correspond to a real file on disk, meaning itspath
field is null.Main.CurrentInstanceUpdated
always saves the currentGUIConfiguration
object before loading the next one, but this causes an attempt to write to a null file path with the special instance described aboveGUIConfiguration
instance, which can't saveChanges
GUIConfiguration.Save
will abort ifGUIConfiguration.path
is null or empty, which will prevent the exception from occurringMain.CurrentInstanceUpdated
, where it will have a validGUIConfiguration
object and therefore always be able to save your choiceFixes #3862.
We should do a hotfix release after this merged. I'm thinking v1.33.2, "Laplace" Δ.