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

Alexandre Janniaux ajanni at videolabs.io
Tue Oct 15 14:18:51 CEST 2019


Hi,

Thank you for review,
Ping for the merge.

Regards,
--
Alexandre Janniaux
Videolabs

On Wed, Oct 09, 2019 at 07:02:49PM +0200, 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


More information about the vlc-devel mailing list