[vlc-commits] qt: add error checking when getting media from the ML

Pierre Lamot git at videolan.org
Thu Jun 13 13:10:28 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Jun 13 12:54:14 2019 +0200| [162aa0f3a9bcab7574f8ef5db71359776d4b20b4] | committer: Thomas Guillem

qt: add error checking when getting media from the ML

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

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

 modules/gui/qt/components/mediacenter/mcmedialib.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/gui/qt/components/mediacenter/mcmedialib.cpp b/modules/gui/qt/components/mediacenter/mcmedialib.cpp
index 9570253345..2fdf3159a0 100644
--- a/modules/gui/qt/components/mediacenter/mcmedialib.cpp
+++ b/modules/gui/qt/components/mediacenter/mcmedialib.cpp
@@ -94,6 +94,8 @@ void MCMediaLib::addToPlaylist(const MLParentId & itemId)
         vlc_ml_query_params_t query;
         memset(&query, 0, sizeof(vlc_ml_query_params_t));
         ml_unique_ptr<vlc_ml_media_list_t> media_list(vlc_ml_list_media_of( m_ml, &query, itemId.type, itemId.id));
+        if (media_list == nullptr)
+            return;
 
         auto mediaRange = ml_range_iterate<vlc_ml_media_t>( media_list );
         QVector<vlc::playlist::Media> medias;
@@ -147,6 +149,8 @@ void MCMediaLib::addAndPlay(const MLParentId & itemId )
         vlc_ml_query_params_t query;
         memset(&query, 0, sizeof(vlc_ml_query_params_t));
         ml_unique_ptr<vlc_ml_media_list_t> media_list(vlc_ml_list_media_of( m_ml, &query, itemId.type, itemId.id));
+        if (media_list == nullptr)
+            return;
 
         auto mediaRange = ml_range_iterate<vlc_ml_media_t>( media_list );
         QVector<vlc::playlist::Media> medias;



More information about the vlc-commits mailing list