Fix src type=nil NSDictionary crash (#455)
- Use NSNull object in NSDictionary when type (or URI) missing from supplied src object. - In addition, defensively supply valid strings for URI and type from JS.
This commit is contained in:
committed by
Matt Apperson
parent
2b709a5d54
commit
201335f05c
@@ -277,15 +277,16 @@ static NSString *const playbackRate = @"rate";
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
//Perform on next run loop, otherwise onVideoLoadStart is nil
|
||||
if(self.onVideoLoadStart) {
|
||||
self.onVideoLoadStart(@{@"src": @{
|
||||
@"uri": [source objectForKey:@"uri"],
|
||||
@"type": [source objectForKey:@"type"],
|
||||
@"isNetwork": [NSNumber numberWithBool:(bool)[source objectForKey:@"isNetwork"]]},
|
||||
@"target": self.reactTag
|
||||
});
|
||||
}
|
||||
|
||||
if(self.onVideoLoadStart) {
|
||||
id uri = [source objectForKey:@"uri"];
|
||||
id type = [source objectForKey:@"type"];
|
||||
self.onVideoLoadStart(@{@"src": @{
|
||||
@"uri": uri ? uri : [NSNull null],
|
||||
@"type": type ? type : [NSNull null],
|
||||
@"isNetwork": [NSNumber numberWithBool:(bool)[source objectForKey:@"isNetwork"]]},
|
||||
@"target": self.reactTag
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user