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

David Fuhrmann git at videolan.org
Fri May 11 17:32:37 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun May  6 10:49:22 2012 +0200| [127ffb40b599ffd882d7d757c53ca9266cb8c792] | committer: David Fuhrmann

macosx: avoid index out of bound exceptions in some cases
(cherry picked from commit 2aa0ad9c3da62df3f31ff317bd747eb0b8524b71)

Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=127ffb40b599ffd882d7d757c53ca9266cb8c792
---

 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 3576be8..b594fcc 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1832,7 +1832,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: YES];
@@ -1993,7 +1994,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