[vlc-commits] OSX: fix crash when no SD are found

Rafaël Carré git at videolan.org
Sat Jun 22 14:27:52 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sat Jun 22 14:24:53 2013 +0200| [2bbc88ce52cbfd9ce6a3c47d1397a21f6a972495] | committer: Rafaël Carré

OSX: fix crash when no SD are found

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

 modules/gui/macosx/MainWindow.m |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 2a499cf..d4e0f0c 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -227,8 +227,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
     SideBarItem *internetItem = [SideBarItem itemWithTitle:_NS("INTERNET") identifier:@"internet"];
 
     /* SD subnodes, inspired by the Qt4 intf */
-    char **ppsz_longnames;
-    int *p_categories;
+    char **ppsz_longnames = NULL;
+    int *p_categories = NULL;
     char **ppsz_names = vlc_sd_GetNames(pl_Get(VLCIntf), &ppsz_longnames, &p_categories);
     if (!ppsz_names)
         msg_Err(VLCIntf, "no sd item found"); //TODO
@@ -239,7 +239,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     NSMutableArray *lanItems = [[NSMutableArray alloc] init];
     NSMutableArray *mycompItems = [[NSMutableArray alloc] init];
     NSString *o_identifier;
-    for (; *ppsz_name; ppsz_name++, ppsz_longname++, p_category++) {
+    for (; ppsz_name && *ppsz_name; ppsz_name++, ppsz_longname++, p_category++) {
         o_identifier = [NSString stringWithCString: *ppsz_name encoding: NSUTF8StringEncoding];
         switch (*p_category) {
             case SD_CAT_INTERNET:



More information about the vlc-commits mailing list