From cc5de69e9fb53b4d5b081aaf78b14a57f7bcbcb2 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 24 Jun 2022 00:34:30 -0700 Subject: [PATCH] [Core Data Store] Fix startup playlist pruning The playlist was being pruned of entries marked for deletion, but they were not being pruned from the set that was then added to the player. Signed-off-by: Christopher Snowhill --- Playlist/PlaylistLoader.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index 3cc326f23..c2e093461 100644 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -868,7 +868,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path); NSMutableIndexSet *pruneSet = [[NSMutableIndexSet alloc] init]; NSUInteger index = 0; for(PlaylistEntry *pe in resultsCopy) { - if(pe.deLeted || !pe.url) { + if(pe.deLeted || !pe.urlString || [pe.urlString length] < 1) { [pruneSet addIndex:index]; [moc deleteObject:pe]; } @@ -878,6 +878,8 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path); if([pruneSet count]) { [playlistController commitPersistentStore]; } + + results = [NSArray arrayWithArray:resultsCopy]; { NSIndexSet *is = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [results count])];