Fixed NPE during dispose in Response if entity is null

This commit is contained in:
Sandeep Kulkarni 2021-03-18 13:28:11 +05:30 committed by Oleg Kalnichevski
parent 879a063b57
commit bde58d6add
1 changed files with 5 additions and 4 deletions

View File

@ -70,9 +70,11 @@ public class Response {
}
try {
final HttpEntity entity = this.response.getEntity();
final InputStream content = entity.getContent();
if (content != null) {
content.close();
if (entity != null) {
final InputStream content = entity.getContent();
if (content != null) {
content.close();
}
}
} catch (final Exception ignore) {
} finally {
@ -133,7 +135,6 @@ public class Response {
}
} finally {
this.consumed = true;
}
}