diff options
-rw-r--r-- | src/schemes/about/profiles.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/schemes/about/profiles.c b/src/schemes/about/profiles.c index c2b7a96..7e2bb7d 100644 --- a/src/schemes/about/profiles.c +++ b/src/schemes/about/profiles.c @@ -117,16 +117,22 @@ edit_profiles(MqProfiles *profiles, GHashTable *query) for (key = keys; key; key = key->next) { if (g_str_has_prefix(key->data, "save_")) { id = (gchar *) key->data + strlen("save_"); - input_key = g_strconcat("name_", id, NULL); - mq_profiles_set_name(profiles, id, - g_hash_table_lookup(query, input_key)); - g_free(input_key); + if (id[0]) { /* Edit existing profile. */ + input_key = g_strconcat("name_", id, NULL); + mq_profiles_set_name(profiles, id, + g_hash_table_lookup(query, input_key)); + g_free(input_key); + } } else if (g_str_has_prefix(key->data, "delete_")) { id = (gchar *) key->data + strlen("delete_"); - mq_profiles_remove(profiles, id); + if (id[0]) { /* Don't remove new profile. */ + mq_profiles_remove(profiles, id); + } } else if (g_str_has_prefix(key->data, "default_")) { id = (gchar *) key->data + strlen("default_"); - mq_profiles_set_default(profiles, id); + if (id[0]) { /* Don't set new profile as default. */ + mq_profiles_set_default(profiles, id); + } } } |