[vlc-commits] macosx: avoid index out of bound exceptions in some cases

David Fuhrmann git at videolan.org
Sun May 6 12:34:18 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun May  6 10:49:22 2012 +0200| [2aa0ad9c3da62df3f31ff317bd747eb0b8524b71] | committer: David Fuhrmann

macosx: avoid index out of bound exceptions in some cases

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

 modules/gui/macosx/MainWindow.m |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index e8d7faf..25840f3 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1835,7 +1835,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (void)hasBecomeFullscreen
 {
-    [o_fullscreen_window makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
+    if( [[o_video_view subviews] count] > 0 )
+        [o_fullscreen_window makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
 
     [o_fullscreen_window makeKeyWindow];
     [o_fullscreen_window setAcceptsMouseMovedEvents: TRUE];
@@ -1996,7 +1997,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [[o_temp_view superview] replaceSubview:o_temp_view with:o_video_view];
     [o_video_view release];
     [o_video_view setFrame:[o_temp_view frame]];
-    [[o_video_view window] makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
+    if( [[o_video_view subviews] count] > 0 )
+        [[o_video_view window] makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
     if( [[o_video_view window] isVisible] )
     {
         if( !b_nonembedded )



More information about the vlc-commits mailing list