diff options
author | Max Kellermann <max@duempel.org> | 2008-09-17 12:29:06 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-17 12:29:06 +0200 |
commit | 9e7dda69f7951f678a1b31d693dba90199d17248 (patch) | |
tree | 70bed05ebf41105a5b5ae9d47bdc6a42252aff3b /src/mpdclient.c | |
parent | 51f4e9634dc17f7b433967b0cc46a0945cf26b85 (diff) | |
download | mpd-9e7dda69f7951f678a1b31d693dba90199d17248.tar.gz mpd-9e7dda69f7951f678a1b31d693dba90199d17248.tar.xz mpd-9e7dda69f7951f678a1b31d693dba90199d17248.zip |
playlist: use playlist_get() instead of playlist_get_song()
Diffstat (limited to 'src/mpdclient.c')
-rw-r--r-- | src/mpdclient.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c index 2318dcffc..ae4a7618f 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -439,11 +439,13 @@ gint mpdclient_cmd_delete(mpdclient_t *c, gint idx) { gint retval = 0; - struct mpd_song *song = playlist_get_song(c, idx); + struct mpd_song *song; - if( !song ) + if (idx < 0 || (guint)idx >= playlist_length(&c->playlist)) return -1; + song = playlist_get(&c->playlist, idx); + /* send the delete command to mpd */ #ifdef ENABLE_SONG_ID D("Delete id:%d\n", song->id); @@ -487,8 +489,8 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index) (guint)new_index >= c->playlist.list->len) return -1; - song1 = playlist_get_song(c, old_index); - song2 = playlist_get_song(c, new_index); + song1 = playlist_get(&c->playlist, old_index); + song2 = playlist_get(&c->playlist, new_index); /* send the move command to mpd */ #ifdef ENABLE_SONG_ID |