]> git.sesse.net Git - vlc/commitdiff
osx: fix crash with --no-media-library
authorRafaël Carré <funman@videolan.org>
Sat, 22 Jun 2013 11:39:08 +0000 (13:39 +0200)
committerRafaël Carré <funman@videolan.org>
Sat, 22 Jun 2013 11:45:20 +0000 (13:45 +0200)
modules/gui/macosx/MainWindow.m

index 2c30791f2d50d01793b314084671ec7eed4f8acc..2a499cf3a5fbf6822a7c2a98b71d9251c20bc24f 100644 (file)
@@ -914,7 +914,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 - (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item
 {
     playlist_t * p_playlist = pl_Get(VLCIntf);
-    NSInteger i_playlist_size;
+    NSInteger i_playlist_size = 0;
 
     if ([[item identifier] isEqualToString: @"playlist"]) {
         PL_LOCK;
@@ -925,7 +925,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
     }
     if ([[item identifier] isEqualToString: @"medialibrary"]) {
         PL_LOCK;
-        i_playlist_size = p_playlist->p_ml_category->i_children;
+        if (p_playlist->p_ml_category)
+            i_playlist_size = p_playlist->p_ml_category->i_children;
         PL_UNLOCK;
 
         return i_playlist_size;
@@ -1014,7 +1015,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
     if ([[item identifier] isEqualToString:@"playlist"]) {
         [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_local_category];
     } else if ([[item identifier] isEqualToString:@"medialibrary"]) {
-        [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_ml_category];
+        if (p_playlist->p_ml_category)
+            [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_ml_category];
     } else {
         playlist_item_t * pl_item;
         PL_LOCK;