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

Alexandre Janniaux git at videolan.org
Tue Oct 15 15:01:51 CEST 2019


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Oct  9 19:02:49 2019 +0200| [0cf887327815eaf579af035a6094a2e0a4be81dd] | committer: Thomas Guillem

qt: playlist: ensure we don't add zero media

It might already assert when calling vlc_playlist_GoTo but it doesn't
assert when startPlaying is false.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 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 8b0137138e..11933b3d84 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)



More information about the vlc-commits mailing list