diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2011-10-22 19:31:57 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2011-10-22 19:31:57 +0200 |
commit | ffe3ed8bbfc5ed658b8d16c9510b7fb57208c788 (patch) | |
tree | 57adcc6023f8e70e01449b6924f9513587d4744b | |
parent | ba60fbc4274e85fb63d373207f525aa57bc75eb3 (diff) | |
download | pianobar-ffe3ed8bbfc5ed658b8d16c9510b7fb57208c788.tar.gz pianobar-ffe3ed8bbfc5ed658b8d16c9510b7fb57208c788.tar.bz2 pianobar-ffe3ed8bbfc5ed658b8d16c9510b7fb57208c788.zip |
piano: A few more assertions
-rw-r--r-- | src/libpiano/xml.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libpiano/xml.c b/src/libpiano/xml.c index 1dd2a24..de554b3 100644 --- a/src/libpiano/xml.c +++ b/src/libpiano/xml.c @@ -840,7 +840,11 @@ static void PianoXmlParseSeedCb (const char *key, const ezxml_t value, void *data) { struct PianoXmlParseSeedBag *bag = data; + assert (bag != NULL); + if (strcmp ("song", key) == 0) { + assert (bag->song == NULL); + if ((bag->song = calloc (1, sizeof (*bag->song))) == NULL) { return; } @@ -848,6 +852,8 @@ static void PianoXmlParseSeedCb (const char *key, const ezxml_t value, PianoXmlStructParser (ezxml_child (value, "struct"), PianoXmlParsePlaylistCb, bag->song); } else if (strcmp ("artist", key) == 0) { + assert (bag->artist == NULL); + if ((bag->artist = calloc (1, sizeof (*bag->artist))) == NULL) { return; } @@ -856,6 +862,8 @@ static void PianoXmlParseSeedCb (const char *key, const ezxml_t value, PianoXmlParseSearchArtistCb, bag->artist); } else if (strcmp ("nonGenomeStation", key) == 0) { /* genre stations are "non genome" station seeds */ + assert (bag->station == NULL); + if ((bag->station = calloc (1, sizeof (*bag->station))) == NULL) { return; } |