Fixed profiles editing crashing application if profile wasn't saved in database.

This commit is contained in:
Stanislav Nikitin 2016-11-25 04:44:46 +05:00
parent 5c295f08ab
commit 190f76eb82

View File

@ -262,26 +262,21 @@ func (op *OptionsProfile) InitializeUpdate(profile_name string) {
op.Initialize(true) op.Initialize(true)
// Get profile data. // Get profile data.
profile := []datamodels.Profile{} profile := ctx.Cache.Profiles[profile_name].Profile
err := ctx.Database.Db.Select(&profile, ctx.Database.Db.Rebind("SELECT * FROM urt_profiles WHERE name=?"), profile_name) op.profile_name.SetText(profile.Name)
if err != nil { op.binary_path.SetText(profile.Binary)
fmt.Println(err.Error()) op.additional_parameters.SetText(profile.Additional_params)
} if profile.Second_x_session == "1" {
op.profile_name.SetText(profile[0].Name)
op.binary_path.SetText(profile[0].Binary)
op.additional_parameters.SetText(profile[0].Additional_params)
if profile[0].Second_x_session == "1" {
op.another_x_session.SetActive(true) op.another_x_session.SetActive(true)
} }
if profile[0].Version == "4.3.0" { if profile.Version == "4.3.0" {
op.urt_version_combo.SetActive(1) op.urt_version_combo.SetActive(1)
} else { } else {
op.urt_version_combo.SetActive(0) op.urt_version_combo.SetActive(0)
} }
op.old_profile = &profile[0] op.old_profile = profile
} }