Skip to content

Commit 6029939

Browse files
authored
Fix occasional NSURLSessionTask creation crash (#6265)
* Fix crash when creating session from nil task * Update changelog
1 parent 1ccb1e8 commit 6029939

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# v4.5.0
22
- [fixed] Fixed a compiler warning and removed unused networking code (#6210).
3+
- [fixed] Fixed a crash that occurred rarely when trying to restart a URL session task without a valid request (#5984).
34
- [added] Introduced watchOS support (#6262).
45

56
# v4.3.1

Crashlytics/Crashlytics/Controllers/FIRCLSNetworkClient.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ - (void)runAfterRetryValueFromResponse:(NSURLResponse *)response block:(void (^)
296296
- (void)restartTask:(NSURLSessionTask *)task {
297297
NSURLRequest *request = [task originalRequest];
298298

299+
if (request == nil) {
300+
FIRCLSWarningLog(@"Unable to restart task: Could not retrieve original request from task %@",
301+
task);
302+
return;
303+
}
304+
299305
[self runAfterRetryValueFromResponse:[task response]
300306
block:^{
301307
NSString *path = [self

0 commit comments

Comments
 (0)