Skip to content

Commit f3679b3

Browse files
authored
Prevent crashes on any Task without currentRequest (#910)
1 parent e4a5657 commit f3679b3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ public class URLSessionInstrumentation {
463463

464464
var originalIMP: IMP?
465465
let block: @convention(block) (URLSessionTask) -> Void = { anyTask in
466+
guard anyTask.responds(to: #selector(getter: URLSessionTask.currentRequest)) else { return }
466467
self.urlSessionTaskWillResume(anyTask)
467468
guard anyTask.currentRequest != nil else { return }
468469
let key = String(theMethod.hashValue)

0 commit comments

Comments
 (0)