浏览代码

VLCNetworkServerBrowserUPnP: fix runtime exception on iOS 7

(cherry picked from commit 414aefdbabac38307b40334e8d1fa5f7c9f5c7a2)
Felix Paul Kühne 7 年之前
父节点
当前提交
56ea99190b
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 14 2
      SharedSources/ServerBrowsing/UPnP/VLCNetworkServerBrowserUPnP.m

+ 14 - 2
SharedSources/ServerBrowsing/UPnP/VLCNetworkServerBrowserUPnP.m

@@ -263,8 +263,20 @@
             // Check for multiple URIs.
             if ([mediaItem.uriCollection count] > 1) {
                 for (NSString *key in mediaItem.uriCollection) {
-                    if ([key containsString:kVLCUPnPVideoProtocolKey] || [key containsString:kVLCUPnPAudioProtocolKey]) {
-                        mediaItem.uri = [mediaItem.uriCollection objectForKey:key];
+                    if ([key respondsToSelector:@selector(containsString:)]) {
+                        if ([key containsString:kVLCUPnPVideoProtocolKey] || [key containsString:kVLCUPnPAudioProtocolKey]) {
+                            mediaItem.uri = [mediaItem.uriCollection objectForKey:key];
+                        }
+                    } else {
+                        NSRange foundRage = [key rangeOfString:kVLCUPnPVideoProtocolKey];
+                        if (foundRage.location != NSNotFound) {
+                            mediaItem.uri = [mediaItem.uriCollection objectForKey:key];
+                        } else {
+                            foundRage = [key rangeOfString:kVLCUPnPAudioProtocolKey];
+                            if (foundRage.location != NSNotFound) {
+                                mediaItem.uri = [mediaItem.uriCollection objectForKey:key];
+                            }
+                        }
                     }
                 }
             }