Fixed crash due to inserting a nil object into an array

Summary: Fixed a crash where making a network request with unrecognized/unsupported scheme would crash by attempting to insert a nil RCTNetworkTask into an array.

Reviewed By: javache

Differential Revision: D3275810

fb-gh-sync-id: be208c6bf87d882209901b850dcc25da4ba79a08
fbshipit-source-id: be208c6bf87d882209901b850dcc25da4ba79a08
This commit is contained in:
Nick Lockwood 2016-05-09 08:17:57 -07:00 committed by Facebook Github Bot 2
parent 191d278fda
commit ed1ee9bc0f
1 changed files with 6 additions and 4 deletions

View File

@ -425,10 +425,12 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
if (!_pendingTasks) {
_pendingTasks = [NSMutableArray new];
}
[_pendingTasks addObject:task];
if (MAX(_activeTasks, _scheduledDecodes) < _maxConcurrentLoadingTasks) {
[task start];
_activeTasks++;
if (task) {
[_pendingTasks addObject:task];
if (MAX(_activeTasks, _scheduledDecodes) < _maxConcurrentLoadingTasks) {
[task start];
_activeTasks++;
}
}
cancelLoad = ^{