Commit fd48bd53 authored by Tobias's avatar Tobias Committed by Felix Paul Kühne
Browse files

replace occurencies of the pattern if (objects.count > 0) object = objects[0];...

replace occurencies of the pattern if (objects.count > 0) object = objects[0]; with object=objects.firstObject;
parent 9340b618
...@@ -186,8 +186,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -186,8 +186,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
return mediaFile; return mediaFile;
} else if (self.mediaList) { } else if (self.mediaList) {
NSArray *results = [MLFile fileForURL:_mediaPlayer.media.url.absoluteString]; NSArray *results = [MLFile fileForURL:_mediaPlayer.media.url.absoluteString];
if (results.count > 0) return results.firstObject;
return results[0];
} }
return nil; return nil;
...@@ -783,8 +782,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -783,8 +782,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[request setSortDescriptors:@[descriptor]]; [request setSortDescriptors:@[descriptor]];
NSArray *matches = [moc executeFetchRequest:request error:nil]; NSArray *matches = [moc executeFetchRequest:request error:nil];
if (matches.count > 0) matchedFile = matches.firstObject;
matchedFile = matches[0];
} }
} }
if (matchedFile.lastPosition) if (matchedFile.lastPosition)
...@@ -907,7 +905,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -907,7 +905,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
} else { } else {
NSArray *files = [MLFile fileForURL:[[_mediaPlayer.media url] absoluteString]]; NSArray *files = [MLFile fileForURL:[[_mediaPlayer.media url] absoluteString]];
if (files.count > 0) { if (files.count > 0) {
MLFile *fileFromList = files[0]; MLFile *fileFromList = files.firstObject;
fileFromList.lastPosition = @([_mediaPlayer position]); fileFromList.lastPosition = @([_mediaPlayer position]);
fileFromList.lastAudioTrack = @(_mediaPlayer.currentAudioTrackIndex); fileFromList.lastAudioTrack = @(_mediaPlayer.currentAudioTrackIndex);
fileFromList.lastSubtitleTrack = @(_mediaPlayer.currentVideoSubTitleIndex); fileFromList.lastSubtitleTrack = @(_mediaPlayer.currentVideoSubTitleIndex);
...@@ -2229,8 +2227,7 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente ...@@ -2229,8 +2227,7 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
item = self.fileFromMediaLibrary; item = self.fileFromMediaLibrary;
else if (self.mediaList) { else if (self.mediaList) {
NSArray *matches = [MLFile fileForURL:[_mediaPlayer.media.url absoluteString]]; NSArray *matches = [MLFile fileForURL:[_mediaPlayer.media.url absoluteString]];
if (matches.count > 0) item = matches.firstObject;
item = matches[0];
} }
if (item) { if (item) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment