Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception at startup w/o default game inst #3863

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions GUI/Main/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,6 @@ protected override void OnShown(EventArgs e)
} while (CurrentInstance == null);
// We can only reach this point if CurrentInstance is not null
// AND we acquired the lock for it successfully
if (!configuration.CheckForUpdatesOnLaunchNoNag && AutoUpdate.CanUpdate)
{
log.Debug("Asking user if they wish for auto-updates");
if (new AskUserForAutoUpdatesDialog().ShowDialog(this) == DialogResult.OK)
configuration.CheckForUpdatesOnLaunch = true;
configuration.CheckForUpdatesOnLaunchNoNag = true;
}
evt.Result = true;
},
(sender, evt) =>
Expand Down Expand Up @@ -390,6 +383,14 @@ private void CurrentInstanceUpdated(bool allowRepoUpdate)
Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml"),
CurrentInstance.game);

if (!configuration.CheckForUpdatesOnLaunchNoNag && AutoUpdate.CanUpdate)
{
log.Debug("Asking user if they wish for auto-updates");
if (new AskUserForAutoUpdatesDialog().ShowDialog(this) == DialogResult.OK)
configuration.CheckForUpdatesOnLaunch = true;
configuration.CheckForUpdatesOnLaunchNoNag = true;
}

var pluginsPath = Path.Combine(CurrentInstance.CkanDir(), "Plugins");
if (!Directory.Exists(pluginsPath))
Directory.CreateDirectory(pluginsPath);
Expand Down
5 changes: 4 additions & 1 deletion GUI/Model/GUIConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ public Point WindowLoc

public void Save()
{
SaveConfiguration(this);
if (!string.IsNullOrEmpty(path))
{
SaveConfiguration(this);
}
}

public static GUIConfiguration LoadOrCreateConfiguration(string path, IGame game)
Expand Down