From 686cf95795fd4b4ea03b5f85705261c6d740d5c9 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 13 Jun 2022 16:27:32 -0700 Subject: [PATCH] [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 --- Playlist/PlaylistController.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index 54f1a222a..93cee041d 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -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]) {