[vlc-devel] [PATCH] macosx: avoid out of bound exception which can occur while reading from log array

David Fuhrmann david.fuhrmann at googlemail.com
Sun Jan 15 20:20:38 CET 2012


---
 modules/gui/macosx/intf.m |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 705da58..6fd25ac 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1863,7 +1863,17 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 
 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
 {
-    return [o_msg_arr objectAtIndex: rowIndex];
+    NSMutableAttributedString *result = NULL;
+    
+    [o_msg_lock lock];
+    if( rowIndex < [o_msg_arr count] )
+        result = [o_msg_arr objectAtIndex: rowIndex];
+    [o_msg_lock unlock];
+    
+    if( result != NULL )
+        return result;
+    else
+        return @"";
 }
 
 - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)i_type withStr: (char *)str
-- 
1.7.5.4




More information about the vlc-devel mailing list