[vlc-devel] [PATCH] qt: playlist: ensure we don't add zero media

Jean-Baptiste Kempf jb at videolan.org
Wed Oct 9 20:10:57 CEST 2019


LGTM

On Wed, Oct 9, 2019, at 19:02, Alexandre Janniaux wrote:
> It might already assert when calling vlc_playlist_GoTo but it doesn't
> assert when startPlaying is false.
> ---
>  modules/gui/qt/components/playlist/playlist_controller.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/modules/gui/qt/components/playlist/playlist_controller.cpp 
> b/modules/gui/qt/components/playlist/playlist_controller.cpp
> index 8b0137138e7..11933b3d84b 100644
> --- a/modules/gui/qt/components/playlist/playlist_controller.cpp
> +++ b/modules/gui/qt/components/playlist/playlist_controller.cpp
> @@ -361,6 +361,9 @@ PlaylistControllerModel::append(const 
> QVector<Media> &media, bool startPlaying)
>      PlaylistLocker locker(d->m_playlist);
> 
>      auto rawMedia = toRaw<input_item_t *>(media);
> +    /* We can't append an empty media. */
> +    assert(rawMedia.size() > 0);
> +
>      int ret = vlc_playlist_Append(d->m_playlist,
>                                    rawMedia.constData(), 
> rawMedia.size());
>      if (ret != VLC_SUCCESS)
> @@ -382,6 +385,9 @@ PlaylistControllerModel::insert(size_t index, const 
> QVector<Media> &media, bool
>      PlaylistLocker locker(d->m_playlist);
> 
>      auto rawMedia = toRaw<input_item_t *>(media);
> +    /* We can't insert an empty media. */
> +    assert(rawMedia.size() > 0);
> +
>      int ret = vlc_playlist_RequestInsert(d->m_playlist, index,
>                                           rawMedia.constData(), 
> rawMedia.size());
>      if (ret != VLC_SUCCESS)
> --
> 2.23.0
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list