This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.16.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.16.x by this push:
     new 57b1316  [AMQ-8395] Avoid possible NPE when sending advisory message
57b1316 is described below

commit 57b1316d213841016f7df26e99b0ffb257133a19
Author: Jean-Baptiste Onofré <[email protected]>
AuthorDate: Mon Oct 4 10:14:32 2021 +0200

    [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 12ae5b7..c1078e3 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 {

Reply via email to