From c37507768cc1bff00a1e574c7fc5038a8a949983 Mon Sep 17 00:00:00 2001 From: Niklas Saers Date: Wed, 19 Sep 2018 12:02:55 +0200 Subject: [PATCH 1/3] Instead of crashing, show a warning and return --- ios/Video/RCTVideo.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 9fe30b6357..0302960b3c 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -436,6 +436,10 @@ - (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlaye bool isAsset = [RCTConvert BOOL:[source objectForKey:@"isAsset"]]; NSString *uri = [source objectForKey:@"uri"]; NSString *type = [source objectForKey:@"type"]; + if([uri isEqualToString:@""] || [type isEqualToString:@""]) { + DebugLog(@"Could not find video URL in source '%@'", source); + return; + } NSURL *url = isNetwork || isAsset ? [NSURL URLWithString:uri] From 865db711792aee133ceb2ab4edbb600513ce80d1 Mon Sep 17 00:00:00 2001 From: Niklas Saers Date: Thu, 20 Sep 2018 13:38:39 +0200 Subject: [PATCH 2/3] Doh, should of course be AND, not OR --- ios/Video/RCTVideo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 0302960b3c..dc1208a35d 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -436,7 +436,7 @@ - (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlaye bool isAsset = [RCTConvert BOOL:[source objectForKey:@"isAsset"]]; NSString *uri = [source objectForKey:@"uri"]; NSString *type = [source objectForKey:@"type"]; - if([uri isEqualToString:@""] || [type isEqualToString:@""]) { + if([uri isEqualToString:@""] && [type isEqualToString:@""]) { DebugLog(@"Could not find video URL in source '%@'", source); return; } From 075dfbaf7fb461b28ee1cfedde11f46247cd0487 Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Mon, 18 Feb 2019 21:34:34 -0800 Subject: [PATCH 3/3] Only check for an empty source --- ios/Video/RCTVideo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index dc1208a35d..79041d9a81 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -436,7 +436,7 @@ - (void)playerItemForSource:(NSDictionary *)source withCallback:(void(^)(AVPlaye bool isAsset = [RCTConvert BOOL:[source objectForKey:@"isAsset"]]; NSString *uri = [source objectForKey:@"uri"]; NSString *type = [source objectForKey:@"type"]; - if([uri isEqualToString:@""] && [type isEqualToString:@""]) { + if (!uri || [uri isEqualToString:@""]) { DebugLog(@"Could not find video URL in source '%@'", source); return; }