[Playlist] Guard entry selection against empty set
Guard the playlist entry retrieval function against being called on an empty playlist, because an empty playlist would result in a division by zero error to occur here. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
e5ff6cd23d
commit
686cf95795
|
@ -885,6 +885,8 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
}
|
}
|
||||||
|
|
||||||
- (PlaylistEntry *)entryAtIndex:(NSInteger)i {
|
- (PlaylistEntry *)entryAtIndex:(NSInteger)i {
|
||||||
|
if([[self arrangedObjects] count] == 0) return nil;
|
||||||
|
|
||||||
RepeatMode repeat = [self repeat];
|
RepeatMode repeat = [self repeat];
|
||||||
|
|
||||||
if(i < 0 || i >= [[self arrangedObjects] count]) {
|
if(i < 0 || i >= [[self arrangedObjects] count]) {
|
||||||
|
|
Loading…
Reference in New Issue