Skip to content

Commit ff5bb26

Browse files
committed
Add null check in case of response.getEntity() is null.
1 parent 4f273e9 commit ff5bb26

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/com/sendgrid/Client.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ public Response getResponse(CloseableHttpResponse response) throws IOException {
135135
int statusCode = response.getStatusLine().getStatusCode();
136136

137137
try {
138-
responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
138+
if(response.getEntity() != null) {
139+
responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
140+
}
139141
} catch (IOException ex) {
140142
throw ex;
141143
}

0 commit comments

Comments
 (0)