Skip to content

Commit

Permalink
add defensive check to anyTask.currentRequest in resume swizzling (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
batuhansk authored Mar 7, 2024
1 parent 2796cc0 commit 812e3fc
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public class URLSessionInstrumentation {
var originalIMP: IMP?
let block: @convention(block) (URLSessionTask) -> Void = { anyTask in
self.urlSessionTaskWillResume(anyTask)
guard anyTask.currentRequest != nil else { return }
let key = String(theMethod.hashValue)
objc_setAssociatedObject(anyTask, key, true, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
let castedIMP = unsafeBitCast(originalIMP, to: (@convention(c) (Any) -> Void).self)
Expand Down

0 comments on commit 812e3fc

Please sign in to comment.