Favorites servers and profiles fix.

If favorite server for some reason have no profile defined - pop up
an error message and do nothing.
This commit is contained in:
Stanislav Nikitin 2016-10-11 20:07:10 +05:00
parent a97b041679
commit 1330699f41

View File

@ -95,7 +95,17 @@ func (m *MainWindow) launchAsUsual() error {
} else if strings.Contains(current_tab, "Favorites") { } else if strings.Contains(current_tab, "Favorites") {
// For favorite servers profile specified in favorite server // For favorite servers profile specified in favorite server
// information have higher priority, so we just override it :) // 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, "", "") m.launchActually(server_profile, user_profile, "", "")