Code

mpdclient: check to assertion in mpdclient_cmd_add()
authorMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:13:06 +0000 (22:13 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:13:06 +0000 (22:13 +0200)
It's illegal to pass song=NULL.

src/mpdclient.c

index e718cd93771bd15d16e2cf9a05241138f4e1edf6..d95e278f55f6a82c81fb40634d5240681b2c1f38 100644 (file)
@@ -402,10 +402,10 @@ mpdclient_cmd_add(struct mpdclient *c, const struct mpd_song *song)
 {
        gint retval = 0;
 
-       if (MPD_ERROR(c))
-               return -1;
+       assert(c != NULL);
+       assert(song != NULL);
 
-       if (song == NULL)
+       if (MPD_ERROR(c))
                return -1;
 
        /* send the add command to mpd */