Parcourir la source

Fix crash when trying to parse non-existing library xmls

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Sylver Bruneau il y a 10 ans
Parent
commit
7367da5a0f
1 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 4
      Sources/VLCSharedLibraryParser.m

+ 5 - 4
Sources/VLCSharedLibraryParser.m

@@ -46,10 +46,11 @@
 {
     NSMutableArray *mutableObjectList = [[NSMutableArray alloc] init];
     mutableObjectList = [self VLCLibraryServerParser:adress port:port];
-    NSString *identifier = [[mutableObjectList objectAtIndex:0] objectForKey:@"identifier"];
-    if ([identifier isEqualToString:@"org.videolan.vlc-ios"])
-        return YES;
-
+    if (mutableObjectList.count > 0) {
+        NSString *identifier = [[mutableObjectList objectAtIndex:0] objectForKey:@"identifier"];
+        if ([identifier isEqualToString:@"org.videolan.vlc-ios"])
+            return YES;
+    }
     return NO;
 }