Skip to content

Commit 50d0a4d

Browse files
authored
Merge pull request #33 from Lemongrass3110/hotfix/issue32
Fixes #32
2 parents e64bf79 + e55aeef commit 50d0a4d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ public final CompletableFuture<JsonObject> toJson(int iid) {
6868
* @return a future that will complete with the JSON builder for the object.
6969
*/
7070
protected CompletableFuture<JsonObjectBuilder> makeBuilder(int instanceId) {
71-
return getValue().exceptionally(t -> {
71+
CompletableFuture<T> futureValue = getValue();
72+
73+
if (futureValue == null) {
74+
logger.error("Could not retrieve value "+this.getClass().getName());
75+
return null;
76+
}
77+
78+
return futureValue.exceptionally(t -> {
7279
logger.error("Could not retrieve value "+this.getClass().getName(), t);
7380
return null;
7481
}).thenApply(value -> {

0 commit comments

Comments
 (0)