Skip to content

Commit adf1ad1

Browse files
authored
Merge pull request #116 from olimpias/fix-nullpointer-for-geterrorreport
Check if error field exists in the json response
2 parents 3257d07 + 7b71180 commit adf1ad1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/src/main/java/com/messagebird/MessageBirdServiceImpl.java

+4
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ private double getVersion() throws GeneralException {
537537
private List<ErrorReport> getErrorReportOrNull(final String body) {
538538
try {
539539
JsonNode jsonNode = mapper.readValue(body, JsonNode.class);
540+
if(!jsonNode.has("errors")) {
541+
return null;
542+
}
543+
540544
ErrorReport[] errors = mapper.readValue(jsonNode.get("errors").toString(), ErrorReport[].class);
541545

542546
List<ErrorReport> result = Arrays.asList(errors);

0 commit comments

Comments
 (0)