[vlc-devel] commit: macosx: fixed crash in case either psz_module or psz_msg are NULL when received from core ( Felix Paul Kühne )

git version control git at videolan.org
Fri Apr 10 12:02:07 CEST 2009


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Apr 10 12:02:04 2009 +0200| [0aeb82b62c3f0690c2c4801e68668c24ce693536] | committer: Felix Paul Kühne 

macosx: fixed crash in case either psz_module or psz_msg are NULL when received from core

Fixes playback of AVI files... ;)

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

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

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 10b1c91..a1503c9 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -157,19 +157,20 @@ static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned int i )
 {
     int canc = vlc_savecancel();
     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
-    
-    NSDictionary *o_dict = [NSDictionary dictionaryWithObjects: 
-                            [NSArray arrayWithObjects: 
-                             [NSString stringWithUTF8String: item->psz_module],
-                             [NSString stringWithUTF8String: item->psz_msg],
-                             [NSNumber numberWithInt: item->i_type], nil] 
-                                                       forKeys:
-                            [NSArray arrayWithObjects: @"Module", @"Message", @"Type", nil]];
-    
+
+    /* this may happen from time to time, let's bail out as info would be useless anyway */ 
+    if( !item->psz_module || !item->psz_msg )
+        return;
+
+    NSDictionary *o_dict = [NSDictionary dictionaryWithObjectsAndKeys:
+                                [NSString stringWithUTF8String: item->psz_module], @"Module",
+                                [NSString stringWithUTF8String: item->psz_msg], @"Message",
+                                [NSNumber numberWithInt: item->i_type], @"Type", nil];
+
     [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCCoreMessageReceived" 
                                                         object: nil 
                                                       userInfo: o_dict];
-    
+
     [o_pool release];
     vlc_restorecancel( canc );
 }




More information about the vlc-devel mailing list