Skip to content

Commit 34f54b9

Browse files
committed
fix : crash when invalid pac file url
1 parent 4746e50 commit 34f54b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ios/Classes/SwiftFlutterSystemProxyPlugin.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ public class SwiftFlutterSystemProxyPlugin: NSObject, FlutterPlugin {
7575
config.connectionProxyDictionary = [AnyHashable: Any]()
7676
let session = URLSession.init(configuration: config,delegate: nil,delegateQueue: OperationQueue.current)
7777
session.dataTask(with: URL(string: pacUrl)!, completionHandler: { data, response, error in
78-
if(error != nil){
78+
if(error != nil || data == nil){
7979
callback(nil,error)
80+
return;
8081
}
8182
pacContent = String(bytes: data!,encoding: String.Encoding.utf8)!
8283
callback(pacContent,nil)

0 commit comments

Comments
 (0)