]> git.sesse.net Git - vlc/commitdiff
OSX: fix crash when no SD are found
authorRafaël Carré <funman@videolan.org>
Sat, 22 Jun 2013 12:24:53 +0000 (14:24 +0200)
committerRafaël Carré <funman@videolan.org>
Sat, 22 Jun 2013 12:27:41 +0000 (14:27 +0200)
modules/gui/macosx/MainWindow.m

index 2a499cf3a5fbf6822a7c2a98b71d9251c20bc24f..d4e0f0c3b09d6f713f7f7bbfe2379b80823908f9 100644 (file)
@@ -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: