summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51f4e96)
raw | patch | inline | side by side (parent: 51f4e96)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:29:06 +0000 (12:29 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:29:06 +0000 (12:29 +0200) |
src/mpdclient.c | patch | blob | history | |
src/screen_play.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 2318dcffc4465b2a38578f9235ed7962f3d84581..ae4a7618faf8567d8589ee541936d635d11ebdf5 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
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);
(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
diff --git a/src/screen_play.c b/src/screen_play.c
index c59c766cd49b5bd3e25985870233c09558249ea7..d257ec1dbabdb11bf9a42095879840e821d1d905 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
mpdclient_t *c = (mpdclient_t *) data;
mpd_Song *song;
- if( (song=playlist_get_song(c, idx)) == NULL ) {
+ if (idx >= playlist_length(&c->playlist))
return NULL;
- }
+
+ song = playlist_get(&c->playlist, idx);
if( c->song && song->id==c->song->id && !IS_STOPPED(c->status->state) ) {
*highlight = 1;