[vlc-devel] [PATCH] qt: fix nullptr dereference

Romain Vimont rom1v at videolabs.io
Wed May 15 15:35:12 CEST 2019


Do not dereference new_media when it is NULL.
---
 modules/gui/qt/components/player_controller.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/components/player_controller.cpp b/modules/gui/qt/components/player_controller.cpp
index e42f7b5b9d..c37ce20e17 100644
--- a/modules/gui/qt/components/player_controller.cpp
+++ b/modules/gui/qt/components/player_controller.cpp
@@ -196,6 +196,11 @@ static  void on_player_current_media_changed(vlc_player_t *, input_item_t *new_m
 {
     PlayerControllerPrivate* that = static_cast<PlayerControllerPrivate*>(data);
     msg_Dbg( that->p_intf, "on_player_current_media_changed");
+
+    if (!new_media)
+        emit that->q_func()->inputChanged(false);
+    return;
+
     InputItemPtr newMediaPtr = InputItemPtr( new_media );
     that->callAsync([that,newMediaPtr] () {
         PlayerController* q = that->q_func();
@@ -205,7 +210,7 @@ static  void on_player_current_media_changed(vlc_player_t *, input_item_t *new_m
 
         RecentsMRL::getInstance( that->p_intf )->addRecent( newMediaPtr.get()->psz_uri );
 
-        emit q->inputChanged( newMediaPtr != nullptr );
+        emit q->inputChanged(true);
     });
 }
 
-- 
2.20.1



More information about the vlc-devel mailing list