[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:54:07 CET 2012


vlc/vlc-1.2 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Jan 15 20:20:38 2012 +0100| [d514f8f71bd40cbe1a81cd6d6862f5c5525e1dbe] | committer: Jean-Baptiste Kempf

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>
(cherry picked from commit 2d81b923ef635a3336f127aa1530f4d3a1d5e18f)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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