MacOSX/VLC_app/VLCBrowsableVideoView.m: Don't crash on empty playlist.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Mon, 7 Jan 2008 21:00:49 +0000 (21:00 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Mon, 7 Jan 2008 21:00:49 +0000 (21:00 +0000)
extras/MacOSX/VLC_app/Sources/VLCBrowsableVideoView.m

index e9e28a3..eb12f19 100644 (file)
         [[self layer] addSublayer:selectionLayer];
     }
     NSArray * items = [self.itemsTree objectAtIndexPath:selectedPath withNodeKeyPath:self.nodeKeyPath];
         [[self layer] addSublayer:selectionLayer];
     }
     NSArray * items = [self.itemsTree objectAtIndexPath:selectedPath withNodeKeyPath:self.nodeKeyPath];
-    if( i < 0 ) i = 0;
+    if( [items count] <= 0 )
+        return;
     if( i >= [items count] ) i = [items count] - 1;
     if( i >= [items count] ) i = [items count] - 1;
+    if( i < 0 ) i = 0;
 
     CALayer * layer = [[menuLayer sublayers] objectAtIndex: i];
     CGRect frame = layer.frame;
 
     CALayer * layer = [[menuLayer sublayers] objectAtIndex: i];
     CGRect frame = layer.frame;