Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit bc027b1

Browse files
committed
Fix IOS app crash issue when redirect URL is empty
1 parent a75f3c2 commit bc027b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ios/RNFetchBlobNetwork.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
147147
self.options = options;
148148
isIncrement = [options valueForKey:@"increment"] == nil ? NO : [[options valueForKey:@"increment"] boolValue];
149149
redirects = [[NSMutableArray alloc] init];
150-
[redirects addObject:req.URL.absoluteString];
150+
if(req.URL != nil)
151+
[redirects addObject:req.URL.absoluteString];
151152

152153
// set response format
153154
NSString * rnfbResp = [req.allHTTPHeaderFields valueForKey:@"RNFB-Response"];
@@ -574,7 +575,8 @@ - (void) URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)sessio
574575

575576
- (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler
576577
{
577-
[redirects addObject:[request.URL absoluteString]];
578+
if(request.URL != nil)
579+
[redirects addObject:[request.URL absoluteString]];
578580
completionHandler(request);
579581
}
580582

0 commit comments

Comments
 (0)