[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 <kode54@gmail.com>
This commit is contained in:
parent
80adb85b36
commit
cc5de69e9f
1 changed files with 3 additions and 1 deletions
|
@ -868,7 +868,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
||||||
NSMutableIndexSet *pruneSet = [[NSMutableIndexSet alloc] init];
|
NSMutableIndexSet *pruneSet = [[NSMutableIndexSet alloc] init];
|
||||||
NSUInteger index = 0;
|
NSUInteger index = 0;
|
||||||
for(PlaylistEntry *pe in resultsCopy) {
|
for(PlaylistEntry *pe in resultsCopy) {
|
||||||
if(pe.deLeted || !pe.url) {
|
if(pe.deLeted || !pe.urlString || [pe.urlString length] < 1) {
|
||||||
[pruneSet addIndex:index];
|
[pruneSet addIndex:index];
|
||||||
[moc deleteObject:pe];
|
[moc deleteObject:pe];
|
||||||
}
|
}
|
||||||
|
@ -878,6 +878,8 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
||||||
if([pruneSet count]) {
|
if([pruneSet count]) {
|
||||||
[playlistController commitPersistentStore];
|
[playlistController commitPersistentStore];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
results = [NSArray arrayWithArray:resultsCopy];
|
||||||
|
|
||||||
{
|
{
|
||||||
NSIndexSet *is = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [results count])];
|
NSIndexSet *is = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [results count])];
|
||||||
|
|
Loading…
Reference in a new issue