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

Romain Vimont rom1v at videolabs.io
Mon Jul 22 17:33:29 CEST 2019


(you could also use vlc_playlist_RequestGoTo() instead, it handles this automatically)

Le 22 juillet 2019 15:30:57 GMT+02:00, Alexandre Janniaux <ajanni at videolabs.io> a écrit :
>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
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list