Fix SQL playlist loader so it doesn't crash on an empty playlist
This commit is contained in:
parent
9c9d71cd9c
commit
098650099e
1 changed files with 4 additions and 6 deletions
|
@ -679,13 +679,11 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
//Clear the selection
|
||||
[playlistController setSelectionIndexes:[NSIndexSet indexSet]];
|
||||
|
||||
NSArray* arrayFirst = [NSArray arrayWithObject:[entries objectAtIndex:0]];
|
||||
NSMutableArray* arrayRest = [entries mutableCopy];
|
||||
[arrayRest removeObjectAtIndex:0];
|
||||
if ([entries count])
|
||||
{
|
||||
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(syncLoadInfoForEntries:) withObject:arrayFirst waitUntilDone:YES];
|
||||
if ([arrayRest count])
|
||||
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:arrayRest];
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue