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