Fix crash in [NSURLConnectionVCR connection:didReceiveData]
Richard Lee
Branch: dlackty/nsurlconnectionvcr:fix-expectedContentLength
Branch: martijnthe/nsurlconnectionvcr:master
Merged
Merged pull request
Merged in dlackty/nsurlconnectionvcr/fix-expectedContentLength (pull request #2)
In
NSURLConnectionVCR.m
#365 line, there's a code snippets as below.long long expectedContentLength = [response expectedContentLength]; responseData = [NSMutableData dataWithCapacity:expectedContentLength];
where
[response expectedContentLength]
might return-1
as suggested by Cocoa official doc, which will cause a crash for[NSMutableData dataWithCapacity:expectedContentLength]
.This should also close issue #1. Please help review, and let me know if there's any problem. Thanks!