Skip to content

Commit

Permalink
fix: check targetId before unregistering the connector
Browse files Browse the repository at this point in the history
When the handshake has failed, the targetId is not defined, and the
removal was throwing a NullPointerException.
  • Loading branch information
jgiovaresco committed Mar 26, 2024
1 parent 4a06bad commit e41446a
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -68,7 +68,9 @@ public Completable register(final ExchangeConnector exchangeConnector) {
public Completable unregister(final ExchangeConnector exchangeConnector) {
return Completable
.defer(() -> {
exchangeConnectors.remove(exchangeConnector.targetId(), exchangeConnector);
if (exchangeConnector.targetId() != null) {
exchangeConnectors.remove(exchangeConnector.targetId(), exchangeConnector);
}
return exchangeConnector.close();
})
.doOnComplete(() -> log.debug("Connector successfully unregister for target [{}]", exchangeConnector.targetId()))
Expand Down

0 comments on commit e41446a

Please sign in to comment.