From e7f647232dadfbd52c6cf691006e3aab69246837 Mon Sep 17 00:00:00 2001 From: Jason Separovic Date: Mon, 28 Jun 2021 13:13:07 -0700 Subject: [PATCH] fix #1449 : check controllerMetadata is not null --- lib/kafkaClient.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/kafkaClient.js b/lib/kafkaClient.js index 1debd7bd..8413c645 100644 --- a/lib/kafkaClient.js +++ b/lib/kafkaClient.js @@ -279,7 +279,10 @@ KafkaClient.prototype.getController = function (callback) { var controllerId = result[1].clusterMetadata.controllerId; var controllerMetadata = result[0][controllerId]; - var broker = this.getBroker(controllerMetadata.host, controllerMetadata.port); + var broker; + if(controllerMetadata) { + broker = this.getBroker(controllerMetadata.host, controllerMetadata.port); + } if (!broker || !broker.isConnected()) { this.refreshBrokerMetadata();