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

Alexandre Janniaux ajanni at videolabs.io
Mon Jul 22 15:30:57 CEST 2019


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


More information about the vlc-devel mailing list