[vlc-commits] osx: fix crash with --no-media-library

Rafaël Carré git at videolan.org
Sat Jun 22 13:45:31 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sat Jun 22 13:39:08 2013 +0200| [82120ce29b5411e9d99d5bf1ea798b68dc9f475a] | committer: Rafaël Carré

osx: fix crash with --no-media-library

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

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

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 2c30791..2a499cf 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -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;



More information about the vlc-commits mailing list