[vlc-commits] mac plugin: add a few missing sanity checks

Felix Paul Kühne git at videolan.org
Thu Nov 6 21:20:16 CET 2014


npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Nov  6 21:19:02 2014 +0100| [cb9e9f4c69c620a7b5ef6d586e6083929259c5ac] | committer: Felix Paul Kühne

mac plugin: add a few missing sanity checks

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

 npapi/vlcplugin_mac.mm |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 7d6c66f..c242f20 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -174,15 +174,15 @@ VlcPluginMac::VlcPluginMac(NPP instance, NPuint16_t mode) :
 
 VlcPluginMac::~VlcPluginMac()
 {
-    if (fullscreenWindow)
+    if (fullscreenWindow != NULL)
         [fullscreenWindow release];
-    if (playbackLayer)
+    if (playbackLayer != NULL)
         [playbackLayer release];
-    if (noMediaLayer)
+    if (noMediaLayer != NULL)
         [noMediaLayer release];
-    if (controllerLayer)
+    if (controllerLayer != NULL)
         [controllerLayer release];
-    if (browserRootLayer)
+    if (browserRootLayer != NULL)
         [browserRootLayer release];
 }
 
@@ -225,6 +225,11 @@ void VlcPluginMac::toggle_fullscreen()
 
         [[fullscreenWindow contentView] enterFullScreenMode: [NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: 0], NSFullScreenModeAllScreens, nil]];
     } else {
+        if (!fullscreenWindow)
+            return;
+        if (!fullscreenWindow.contentView)
+            return;
+
         [[fullscreenWindow contentView] exitFullScreenModeWithOptions: nil];
         [noMediaLayer removeFromSuperlayer];
         [playbackLayer removeFromSuperlayer];



More information about the vlc-commits mailing list