Skip to content

Commit

Permalink
fix #1449 : check controllerMetadata is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Separovic committed Jun 28, 2021
1 parent fcc8aef commit e7f6472
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/kafkaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e7f6472

Please sign in to comment.