Skip to content

Commit 4c2d2c2

Browse files
committed
Fix segmentation fault by replacing Error with NSError
1 parent 50428d8 commit 4c2d2c2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Foundation/NSURLSession/NSURLSessionTask.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ open class URLSessionTask : NSObject, NSCopying {
221221
* The error, if any, delivered via -URLSession:task:didCompleteWithError:
222222
* This property will be nil in the event that no error occured.
223223
*/
224-
fileprivate var _error: Error?
225-
/*@NSCopying*/ open var error: Error? {
224+
fileprivate var _error: NSError?
225+
/*@NSCopying*/ open var error: NSError? {
226226
return self._error
227227
}
228228

TestFoundation/TestNSURLSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class TestURLSession : XCTestCase {
284284
XCTAssertNil(error)
285285

286286
XCTAssertNotNil(task.error)
287-
XCTAssertEqual((task.error as! NSError).code, NSURLErrorBadURL)
287+
XCTAssertEqual(task.error?.code, NSURLErrorBadURL)
288288
}
289289
}
290290

0 commit comments

Comments
 (0)