summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2010-12-04 20:57:00 +0100
committerLars-Dominik Braun <lars@6xq.net>2010-12-04 20:57:00 +0100
commita6340288f8259cc96b5af05bce3612dbf4f9b7e4 (patch)
treeb09268cf7c009b1f9773eca13f07d3965d0f5082
parent91192bd1473d6a43eb27ea802ac6fbd451f28fb2 (diff)
downloadpianobar-windows-a6340288f8259cc96b5af05bce3612dbf4f9b7e4.tar.gz
pianobar-windows-a6340288f8259cc96b5af05bce3612dbf4f9b7e4.tar.bz2
pianobar-windows-a6340288f8259cc96b5af05bce3612dbf4f9b7e4.zip
Show default icons if config file is missing.
Bug introduced by 2b31c97de6fa541719cd26f9a61053cfc0e71203. "(null)" was shown instead of "<3" and "</3".
-rw-r--r--src/settings.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/settings.c b/src/settings.c
index 64b56c4..259c9f0 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -118,6 +118,8 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->history = 5;
settings->sortOrder = BAR_SORT_NAME_AZ;
memcpy (settings->keys, defaultKeys, sizeof (defaultKeys));
+ settings->loveIcon = strdup ("<3");
+ settings->banIcon = strdup ("</3");
BarGetXdgConfigDir (PACKAGE "/config", configfile, sizeof (configfile));
if ((configfd = fopen (configfile, "r")) == NULL) {
@@ -180,8 +182,10 @@ void BarSettingsRead (BarSettings_t *settings) {
}
}
} else if (streq ("love_icon", key)) {
+ free (settings->loveIcon);
settings->loveIcon = strdup (val);
} else if (streq ("ban_icon", key)) {
+ free (settings->banIcon);
settings->banIcon = strdup (val);
}
}
@@ -194,13 +198,5 @@ void BarSettingsRead (BarSettings_t *settings) {
}
}
- /* use default strings */
- if (settings->loveIcon == NULL) {
- settings->loveIcon = strdup ("<3");
- }
- if (settings->banIcon == NULL) {
- settings->banIcon = strdup ("</3");
- }
-
fclose (configfd);
}