summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-01-13 15:45:50 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-01-13 15:45:50 +0100
commit994c61fb0da9628161c3ebaab533b9e715d284be (patch)
tree47aa30cc0cc08e338bd88b6e8b4c3f9d91dc7a0e /libpiano
parentc23bc5538a6d8dbd52d06667d9706f05cb5a07d5 (diff)
downloadpianobar-994c61fb0da9628161c3ebaab533b9e715d284be.tar.gz
pianobar-994c61fb0da9628161c3ebaab533b9e715d284be.tar.bz2
pianobar-994c61fb0da9628161c3ebaab533b9e715d284be.zip
piano: Don't segfault with empty quickmix list
Diffstat (limited to 'libpiano')
-rw-r--r--libpiano/src/xml.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c
index 66e937e..95e9756 100644
--- a/libpiano/src/xml.c
+++ b/libpiano/src/xml.c
@@ -388,17 +388,19 @@ PianoReturn_t PianoXmlParseStations (PianoHandle_t *ph, const char *xml) {
}
}
/* set quickmix flags after all stations are read */
- curQuickMixId = quickMixIds;
- while (*curQuickMixId != NULL) {
- PianoStation_t *curStation = PianoFindStationById (ph->stations,
- *curQuickMixId);
- if (curStation != NULL) {
- curStation->useQuickMix = 1;
+ if (quickMixIds != NULL) {
+ curQuickMixId = quickMixIds;
+ while (*curQuickMixId != NULL) {
+ PianoStation_t *curStation = PianoFindStationById (ph->stations,
+ *curQuickMixId);
+ if (curStation != NULL) {
+ curStation->useQuickMix = 1;
+ }
+ free (*curQuickMixId);
+ curQuickMixId++;
}
- free (*curQuickMixId);
- curQuickMixId++;
+ free (quickMixIds);
}
- free (quickMixIds);
xmlFreeDoc (doc);
return PIANO_RET_OK;