Skip to content
Browse files

Merge pull request #717 from ettore/blank-urlPath-fix

Preventing occasional crash in TTURLRequestQueue :: createNSURLRequest:URL:
  • Loading branch information...
2 parents 7c3de70 + d2bf8d2 commit 889b14a404e363eead3bd748130c2f2771458302 @jwang jwang committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/Three20Network/Sources/TTRequestLoader.m
View
7 src/Three20Network/Sources/TTRequestLoader.m
@@ -120,6 +120,13 @@ - (void)connectToURL:(NSURL*)URL {
TTNetworkRequestStarted();
TTURLRequest* request = _requests.count == 1 ? [_requests objectAtIndex:0] : nil;
+
+ // there are situations where urlPath is somehow nil (therefore crashing in
+ // createNSURLRequest:URL:, even if we checked for non-blank values before
+ // adding the request to the queue.
+ if (!request.urlPath.length)
+ [self cancel:request];
+
NSURLRequest* URLRequest = [_queue createNSURLRequest:request URL:URL];
_connection = [[NSURLConnection alloc] initWithRequest:URLRequest delegate:self];

0 comments on commit 889b14a

Please sign in to comment.
Something went wrong with that request. Please try again.