Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
add topic null check
Browse files Browse the repository at this point in the history
  • Loading branch information
dockerzhang committed Dec 18, 2020
1 parent a50ace5 commit b8f2b30
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ public synchronized void close() {
requestHandler.ctx.channel(), references.get(topicName), topicName);
}
if (references.get(topicName) != null) {
topicFuture.get().removeProducer(references.get(topicName));
PersistentTopic persistentTopic = topicFuture.get();
if (persistentTopic != null) {
persistentTopic.removeProducer(references.get(topicName));
}
references.remove(topicName);
}
}
Expand Down Expand Up @@ -373,7 +376,10 @@ public void deReference(String topicName) {
if (!topics.containsKey(topicName)) {
return;
}
topics.get(topicName).get().removeProducer(references.get(topicName));
PersistentTopic persistentTopic = topics.get(topicName).get();
if (persistentTopic != null) {
persistentTopic.removeProducer(references.get(topicName));
}
topics.remove(topicName);
} catch (Exception e) {
log.error("[{}] Failed to close reference for individual topic {}. exception:",
Expand Down

0 comments on commit b8f2b30

Please sign in to comment.