Code

filelist: song must not be NULL
authorMax Kellermann <max@duempel.org>
Fri, 19 Sep 2008 12:42:09 +0000 (14:42 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 19 Sep 2008 12:42:09 +0000 (14:42 +0200)
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.

src/filelist.c

index 6f938ea3069aa3d5ae6ec985c619264023c7fe9f..7b45416062038f778f765bc1a6f17923860f21e1 100644 (file)
@@ -21,6 +21,7 @@
 #include "libmpdclient.h"
 
 #include <string.h>
+#include <assert.h>
 
 void
 mpdclient_filelist_free(struct filelist *filelist)
@@ -51,7 +52,9 @@ mpdclient_filelist_find_song(struct filelist *fl,
 {
        GList *list = g_list_first(fl->list);
 
-       while (list && song) {
+       assert(song != NULL);
+
+       while (list != NULL) {
                filelist_entry_t *entry = list->data;
                mpd_InfoEntity *entity  = entry->entity;