Explorar o código

for library mode none return empty array add nullability annotations

Tobias Conradi %!s(int64=10) %!d(string=hai) anos
pai
achega
715211ef8b

+ 2 - 2
SharedSources/MLMediaLibrary+playlist.h

@@ -23,7 +23,7 @@ typedef NS_ENUM(NSUInteger, VLCLibraryMode) {
 
 @interface MLMediaLibrary (playlist)
 
-- (NSArray *)playlistArrayForGroupObject:(id)groupObject;
-- (NSArray *)playlistArrayForLibraryMode:(VLCLibraryMode)libraryMode;
+- (nonnull NSArray *)playlistArrayForGroupObject:(nonnull id)groupObject;
+- (nonnull NSArray *)playlistArrayForLibraryMode:(VLCLibraryMode)libraryMode;
 
 @end

+ 5 - 2
SharedSources/MLMediaLibrary+playlist.m

@@ -19,7 +19,7 @@
 @implementation MLMediaLibrary (playlist)
 
 
-- (NSArray *)playlistArrayForGroupObject:(id)groupObject
+- (nonnull NSArray *)playlistArrayForGroupObject:(nonnull id)groupObject
 {
     if([groupObject isKindOfClass:[MLLabel class]]) {
         return [(MLLabel *)groupObject sortedFolderItems];
@@ -34,10 +34,13 @@
 }
 
 //TODO: this code could use refactoring to be more readable
-- (NSArray *)playlistArrayForLibraryMode:(VLCLibraryMode)libraryMode
+- (nonnull NSArray *)playlistArrayForLibraryMode:(VLCLibraryMode)libraryMode
 {
 
     NSMutableArray *objects = [NSMutableArray array];
+    if (libraryMode == VLCLibraryModeNone) {
+        return  objects;
+    }
 
     /* add all albums */
     if (libraryMode != VLCLibraryModeAllSeries) {