Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Corrected NullPointerException on request with 204 http status #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/com/loopj/android/http/AsyncHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public void process(HttpRequest request, HttpContext context) {
httpClient.addResponseInterceptor(new HttpResponseInterceptor() {
public void process(HttpResponse response, HttpContext context) {
final HttpEntity entity = response.getEntity();
if (entity == null) {
return;
}
final Header encoding = entity.getContentEncoding();
if (encoding != null) {
for (HeaderElement element : encoding.getElements()) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/loopj/android/http/AsyncHttpResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ void sendResponseMessage(HttpResponse response) {
HttpEntity temp = response.getEntity();
if(temp != null) {
entity = new BufferedHttpEntity(temp);
responseBody = EntityUtils.toString(entity);
}
responseBody = EntityUtils.toString(entity);
} catch(IOException e) {
sendFailureMessage(e, null);
}
Expand Down