[vlc-commits] qt: playlist: don't call vlc_playlist_GoTo if playlist is empty

Alexandre Janniaux git at videolan.org
Tue Jul 30 17:58:08 CEST 2019


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Mon Jul 22 15:30:57 2019 +0200| [679a38a6bf36d23cfe2a0ff83153ff05bb58f367] | committer: Jean-Baptiste Kempf

qt: playlist: don't call vlc_playlist_GoTo if playlist is empty

It was failing on the following assertion in vlc_playlist_GoTo:
`index == -1 || (size_t) index < playlist->items.size'

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=679a38a6bf36d23cfe2a0ff83153ff05bb58f367
---

 modules/gui/qt/components/playlist/playlist_controller.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/components/playlist/playlist_controller.cpp b/modules/gui/qt/components/playlist/playlist_controller.cpp
index f32e1b1c40..8b0137138e 100644
--- a/modules/gui/qt/components/playlist/playlist_controller.cpp
+++ b/modules/gui/qt/components/playlist/playlist_controller.cpp
@@ -560,7 +560,8 @@ void PlaylistControllerModel::goTo(uint index, bool startPlaying)
 {
     Q_D(PlaylistControllerModel);
     PlaylistLocker lock{ d->m_playlist };
-    if (index > vlc_playlist_Count( d->m_playlist ) -1)
+    size_t count = vlc_playlist_Count( d->m_playlist );
+    if (count == 0 || index > count-1)
         return;
     vlc_playlist_GoTo( d->m_playlist, index );
     if (startPlaying)



More information about the vlc-commits mailing list