[sensebox] Fix NPE (#14879)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
fafcc68423
commit
b07dd3c48f
@ -71,6 +71,7 @@ public class SenseBoxAPIConnection {
|
||||
logger.trace("Fetched Data: {}", body);
|
||||
SenseBoxData parsedData = gson.fromJson(body, SenseBoxData.class);
|
||||
|
||||
if (parsedData != null) {
|
||||
// Assume all is well at first
|
||||
parsedData.setStatus(ThingStatus.ONLINE);
|
||||
|
||||
@ -151,6 +152,11 @@ public class SenseBoxAPIConnection {
|
||||
logger.trace("=================================");
|
||||
|
||||
result = parsedData;
|
||||
} else {
|
||||
logger.debug("An error occurred while parsing the data into desired class: {} / {}", body,
|
||||
SenseBoxData.class.getName());
|
||||
result.setStatus(ThingStatus.OFFLINE);
|
||||
}
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("An error occurred while parsing the data into desired class: {} / {} / {}", body,
|
||||
SenseBoxData.class.getName(), e.getMessage());
|
||||
@ -159,7 +165,6 @@ public class SenseBoxAPIConnection {
|
||||
logger.debug("IO problems while fetching data: {} / {}", query, e.getMessage());
|
||||
result.setStatus(ThingStatus.OFFLINE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user