Fix array bounds issues with album shuffle builder
The shuffle list builder was encountering errors when some album tags or empty album tags led to empty lists. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
f203911bb1
commit
5330295a97
1 changed files with 5 additions and 3 deletions
|
@ -894,7 +894,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
if([album length] > 0)
|
if([album length] > 0)
|
||||||
predicate = [NSPredicate predicateWithFormat:@"album like %@", album];
|
predicate = [NSPredicate predicateWithFormat:@"album like %@", album];
|
||||||
else
|
else
|
||||||
predicate = [NSPredicate predicateWithFormat:@"album == nil"];
|
predicate = [NSPredicate predicateWithFormat:@"album == nil || album like %@", @""];
|
||||||
return [[self arrangedObjects] filteredArrayUsingPredicate:predicate];
|
return [[self arrangedObjects] filteredArrayUsingPredicate:predicate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -960,6 +960,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
NSArray *albumContent = [self filterPlaylistOnAlbum:album];
|
NSArray *albumContent = [self filterPlaylistOnAlbum:album];
|
||||||
NSArray *sortedContent =
|
NSArray *sortedContent =
|
||||||
[albumContent sortedArrayUsingDescriptors:@[sortDescriptor]];
|
[albumContent sortedArrayUsingDescriptors:@[sortDescriptor]];
|
||||||
|
if(sortedContent && [sortedContent count])
|
||||||
[temp addObject:sortedContent[0]];
|
[temp addObject:sortedContent[0]];
|
||||||
}
|
}
|
||||||
NSArray *tempList = [Shuffle shuffleList:temp];
|
NSArray *tempList = [Shuffle shuffleList:temp];
|
||||||
|
@ -970,6 +971,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
NSArray *albumContent = [self filterPlaylistOnAlbum:album];
|
NSArray *albumContent = [self filterPlaylistOnAlbum:album];
|
||||||
NSArray *sortedContent =
|
NSArray *sortedContent =
|
||||||
[albumContent sortedArrayUsingDescriptors:@[sortDescriptor]];
|
[albumContent sortedArrayUsingDescriptors:@[sortDescriptor]];
|
||||||
|
if(sortedContent && [sortedContent count])
|
||||||
[temp addObjectsFromArray:sortedContent];
|
[temp addObjectsFromArray:sortedContent];
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
|
|
Loading…
Reference in a new issue