Check for AVAggregateAssetDownloadTask before checking for its request (#151)

This commit is contained in:
Jakub Olejník
2024-09-14 03:20:59 +02:00
committed by GitHub
parent 6793528c74
commit d25085df4f
+8
View File
@@ -6,6 +6,7 @@
// Copyright © 2020 Proxyman. All rights reserved.
//
import class AVFoundation.AVAggregateAssetDownloadTask
import Foundation
#if os(OSX)
@@ -101,6 +102,13 @@ public final class TrafficPackage: Codable, CustomDebugStringConvertible, Serial
// MARK: - Builder
static func buildRequest(sessionTask: URLSessionTask, id: String) -> TrafficPackage? {
// If sessionTask is AVAggregateAssetDownloadTask,
// accessing currentRequest crashes with not supported error,
// so we need to check for it in advance.
if sessionTask is AVAggregateAssetDownloadTask {
return nil
}
guard let currentRequest = sessionTask.currentRequest,
let request = Request(currentRequest) else { return nil }