[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
Christopher Snowhill 2022-06-13 16:27:32 -07:00
parent e5ff6cd23d
commit 686cf95795
1 changed files with 2 additions and 0 deletions

View File

@ -885,6 +885,8 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
}
- (PlaylistEntry *)entryAtIndex:(NSInteger)i {
if([[self arrangedObjects] count] == 0) return nil;
RepeatMode repeat = [self repeat];
if(i < 0 || i >= [[self arrangedObjects] count]) {