[vlc-commits] GTK: check for media_player before use

Cheng Sun git at videolan.org
Mon Jan 23 19:28:35 CET 2012


npapi-vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Sat Jan 21 11:41:17 2012 +0000| [531b372ef1a4a4ae7f882476e00cdd37afc3285e] | committer: Cheng Sun

GTK: check for media_player before use

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=531b372ef1a4a4ae7f882476e00cdd37afc3285e
---

 npapi/vlcplugin_gtk.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index 09d70ad..c498b4d 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -295,14 +295,18 @@ static bool video_expose_handler(GtkWidget *widget, GdkEvent *event, gpointer us
 static bool time_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
 {
     VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
-    libvlc_media_player_set_position(plugin->getMD(), value/100.0);
+    libvlc_media_player_t *md = plugin->getMD();
+    if (md)
+        libvlc_media_player_set_position(md, value/100.0);
     return false;
 }
 
 static bool vol_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
 {
     VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
-    libvlc_audio_set_volume(plugin->getMD(), value);
+    libvlc_media_player_t *md = plugin->getMD();
+    if (md)
+        libvlc_audio_set_volume(md, value);
     return false;
 }
 



More information about the vlc-commits mailing list