diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-08 15:20:38 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-08 15:20:38 (EST) |
commit | 0e627a3b7891c1922f81db5bf0a7a747c9d11e1e (patch) | |
tree | 7d1c34ce6d98c9d4e7e9829864456d0012d26732 /src | |
parent | ea0c09cb0e613e2682d3c9a976db240eb25d94fa (diff) | |
download | marquee-0e627a3b7891c1922f81db5bf0a7a747c9d11e1e.zip marquee-0e627a3b7891c1922f81db5bf0a7a747c9d11e1e.tar.gz marquee-0e627a3b7891c1922f81db5bf0a7a747c9d11e1e.tar.bz2 |
mq_profiles_get_default(): Handle case of no profiles marked default
Diffstat (limited to 'src')
-rw-r--r-- | src/config/profiles.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c index dbd4e29..28a66f8 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -150,8 +150,14 @@ mq_profiles_get_default(MqProfiles *profiles) ids = g_key_file_get_groups(profiles->key_file, &length); for (i = 0; i < length; ++i) { + if (i == 0) { + /* In case no profile is marked as default, use the + * first one. */ + def = g_strdup(ids[i]); + } if (g_key_file_get_boolean(profiles->key_file, ids[i], "default", NULL)) { + g_free(def); def = g_strdup(ids[i]); break; } |