[vlc-devel] [PATCH 1/3] qt: add error checking when getting media from the ML

Pierre Lamot pierre at videolabs.io
Fri Apr 12 14:22:39 CEST 2019


---
 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;
-- 
2.19.1



More information about the vlc-devel mailing list