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

David Fuhrmann git at videolan.org
Sun Jan 15 20:52:23 CET 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Jan 15 20:20:38 2012 +0100| [2d81b923ef635a3336f127aa1530f4d3a1d5e18f] | committer: Felix Paul Kühne

macosx: avoid out of bound exception which can occur while reading from log array

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 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..85d1607 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



More information about the vlc-commits mailing list