浏览代码

Fix crash when trying to parse non-existing library xmls

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Sylver Bruneau 10 年之前
父节点
当前提交
7367da5a0f
共有 1 个文件被更改,包括 5 次插入4 次删除
  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;
 }