Browse Source

VLCLibraryViewController: fix runtime exception if media is not found

(cherry picked from commit 3ee7d8199ac72b257e5809114079a0fcd55a03a8)
Felix Paul Kühne 7 years ago
parent
commit
0f560bccad
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Sources/VLCLibraryViewController.m

+ 4 - 2
Sources/VLCLibraryViewController.m

@@ -871,9 +871,11 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
     }
 
     if (_folderObject != nil) {
-        //could be NSNotFound
+        id mediaObject;
         NSUInteger folderIndex = [_mediaDataSource indexOfObject:_folderObject];
-        id mediaObject = [_mediaDataSource objectAtIndex:folderIndex];
+        if (folderIndex != NSNotFound) {
+            mediaObject = [_mediaDataSource objectAtIndex:folderIndex];
+        }
 
         //item got dragged onto item
         if ([mediaObject isKindOfClass:[MLFile class]]) {