From 57b1316d213841016f7df26e99b0ffb257133a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Mon, 4 Oct 2021 10:14:32 +0200 Subject: [PATCH] [AMQ-8395] Avoid possible NPE when sending advisory message (cherry picked from commit f74992c1058eb8de051c1ce0779ba4f34ba39ed3) --- .../src/main/java/org/apache/activemq/broker/region/Topic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java index 12ae5b7c7c..c1078e39ba 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java @@ -540,7 +540,7 @@ public class Topic extends BaseDestination implements Task { message.incrementReferenceCount(); - if (context.isInTransaction()) { + if (context.isInTransaction() && (context.getTransaction() != null)) { context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {