diff --git a/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java b/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java index a9064a10b..74835796d 100644 --- a/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java +++ b/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java @@ -68,7 +68,14 @@ public final CompletableFuture toJson(int iid) { * @return a future that will complete with the JSON builder for the object. */ protected CompletableFuture makeBuilder(int instanceId) { - return getValue().exceptionally(t -> { + CompletableFuture futureValue = getValue(); + + if (futureValue == null) { + logger.error("Could not retrieve value "+this.getClass().getName()); + return null; + } + + return futureValue.exceptionally(t -> { logger.error("Could not retrieve value "+this.getClass().getName(), t); return null; }).thenApply(value -> {