diff --git a/src/apps/mediaplayer/ControllerView.cpp b/src/apps/mediaplayer/ControllerView.cpp index 6dc2a25d3c..4c9f03499b 100644 --- a/src/apps/mediaplayer/ControllerView.cpp +++ b/src/apps/mediaplayer/ControllerView.cpp @@ -98,8 +98,10 @@ void ControllerView::TogglePlaying() { BAutolock _(fPlaylist); - if (fPlaylist->CurrentItemIndex() < 0) { - // No valid playlist item - start again from the first one + if (fPlaylist->CurrentItemIndex() == fPlaylist->CountItems() - 1 + && Position() == 1.0) { + // Reached end of playlist and end of last item + // -> start again from the first item. fPlaylist->SetCurrentItemIndex(0); } else fController->TogglePlaying(); diff --git a/src/apps/mediaplayer/playlist/Playlist.cpp b/src/apps/mediaplayer/playlist/Playlist.cpp index b8f014c96e..ba16f10927 100644 --- a/src/apps/mediaplayer/playlist/Playlist.cpp +++ b/src/apps/mediaplayer/playlist/Playlist.cpp @@ -352,11 +352,14 @@ bool Playlist::SetCurrentItemIndex(int32 index) { bool result = true; - if (index >= CountItems() || index < 0) { + if (index >= CountItems()) { + index = CountItems() - 1; + result = false; + } + if (index < 0) { index = -1; result = false; } - if (index == fCurrentIndex) return result;