[vlc-devel] [PATCH] macosx: Prevent invalid access in viewWillMoveToWindow

Marvin Scholz epirat07 at gmail.com
Thu Sep 29 19:26:22 CEST 2016


Previously it was not checked if vout display is null and
trying to access sys->nsColorSpace would result in a crash.
---
 modules/video_output/macosx.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 6c13eb6..f8f49a2 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -839,7 +839,7 @@ - (void)viewWillMoveToWindow:(nullable NSWindow *)newWindow
     [super viewWillMoveToWindow:newWindow];
 
     @try {
-        if (newWindow != nil) {
+        if (newWindow != nil && vd) {
             @synchronized(newWindow) {
                 [newWindow setColorSpace:vd->sys->nsColorSpace];
             }
-- 
2.8.4 (Apple Git-73)



More information about the vlc-devel mailing list