[vlc-commits] qt: fix nullptr dereference

Romain Vimont git at videolan.org
Wed May 22 21:44:24 CEST 2019


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Wed May 15 15:28:22 2019 +0200| [3f659b04f6fb31844a929423b8844f725eb2d6ab] | committer: Jean-Baptiste Kempf

qt: fix nullptr dereference

Do not dereference new_media when it is NULL.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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);
     });
 }
 



More information about the vlc-commits mailing list