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

Prevent runtime exception

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