Commit fc398475 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Prevent runtime exception

parent 382a54cb
...@@ -1027,24 +1027,28 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -1027,24 +1027,28 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
MLLabel *label = _foundMedia[folderIndex]; MLLabel *label = _foundMedia[folderIndex];
[_indexPaths sortUsingSelector:@selector(compare:)]; [_indexPaths sortUsingSelector:@selector(compare:)];
for (NSInteger i = [_indexPaths count] - 1; i >= 0; i--) { @synchronized(self) {
NSIndexPath *path = _indexPaths[i]; NSUInteger count = _foundMedia.count;
if (_libraryMode != VLCLibraryModeCreateFolder && ![_foundMedia[path.row] isKindOfClass:[MLFile class]]) for (NSInteger i = [_indexPaths count] - 1; i >= 0; i--) {
continue; NSIndexPath *path = _indexPaths[i];
if (_libraryMode == VLCLibraryModeCreateFolder) if (path.row >= count)
[self updateViewContents]; continue;
if (_libraryMode != VLCLibraryModeCreateFolder && ![_foundMedia[path.row] isKindOfClass:[MLFile class]])
id item = _foundMedia[path.row]; continue;
if (_libraryMode == VLCLibraryModeCreateFolder)
if (![item isKindOfClass:[MLFile class]]) [self updateViewContents];
continue;
id item = _foundMedia[path.row];
MLFile *file = (MLFile *)item;
file.labels = [NSSet setWithObjects:label, nil]; if (![item isKindOfClass:[MLFile class]])
@synchronized(self) { continue;
MLFile *file = (MLFile *)item;
file.labels = [NSSet setWithObjects:label, nil];
[_foundMedia removeObjectAtIndex:path.row]; [_foundMedia removeObjectAtIndex:path.row];
file.folderTrackNumber = @([label files].count - 1);
} }
file.folderTrackNumber = @([label files].count - 1);
} }
} }
_folderObject = nil; _folderObject = nil;
......
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