From 1330699f41bb5b80619a6b9be105fd160fcaa862 Mon Sep 17 00:00:00 2001 From: pztrn Date: Tue, 11 Oct 2016 20:07:10 +0500 Subject: [PATCH] Favorites servers and profiles fix. If favorite server for some reason have no profile defined - pop up an error message and do nothing. --- ui/mainwindow_launch.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/mainwindow_launch.go b/ui/mainwindow_launch.go index 583a80a..b41c014 100644 --- a/ui/mainwindow_launch.go +++ b/ui/mainwindow_launch.go @@ -95,7 +95,17 @@ func (m *MainWindow) launchAsUsual() error { } else if strings.Contains(current_tab, "Favorites") { // For favorite servers profile specified in favorite server // information have higher priority, so we just override it :) - user_profile = ctx.Cache.Profiles[server_profile.ProfileToUse].Profile + user_profile_cached, ok := ctx.Cache.Profiles[server_profile.ProfileToUse] + if !ok { + mbox_string := "Invalid game profile specified for favorite server.\n\nPlease, edit your favorite server, select valid profile and retry." + m := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string) + m.Response(func() { + m.Destroy() + }) + m.Run() + return errors.New("User didn't select valid profile.") + } + user_profile = user_profile_cached.Profile } m.launchActually(server_profile, user_profile, "", "")