Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #6042 - add null check for mCall to avoid NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
zugaldia committed Aug 24, 2016
1 parent 707a7b7 commit 773776d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ private HTTPRequest(long nativePtr, String resourceUrl, String userAgent, String
}

public void cancel() {
mCall.cancel();
// mCall can be null if the constructor gets aborted (e.g, under a NoRouteToHostException).
if (mCall != null) {
mCall.cancel();
}

// TODO: We need a lock here because we can try
// to cancel at the same time the request is getting
Expand Down

0 comments on commit 773776d

Please sign in to comment.