Skip to content

Commit

Permalink
Add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
moremagic committed Oct 6, 2022
1 parent dd7763b commit 9cdd10a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/akhq/models/Cluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutionException;

@ToString
Expand All @@ -25,6 +26,8 @@ public Cluster(DescribeClusterResult result) throws ExecutionException, Interrup
this.nodes.add(new Node(node));
}

this.controller = new Node(result.controller().get());
Optional.ofNullable(result.controller().get()).ifPresentOrElse(
node -> this.controller = new Node(node),
() -> this.controller = new Node());
}
}

0 comments on commit 9cdd10a

Please sign in to comment.