From 9963f96033418107f5caa5eb86f16ce74ac28312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 28 Jul 2016 23:23:40 +0300 Subject: [PATCH] Fix NPE with null session in MQTTConnectionManager.disconnect() --- .../artemis/core/protocol/mqtt/MQTTConnectionManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java index a3b8b78114..a05ecb52c7 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java @@ -106,8 +106,11 @@ public class MQTTConnectionManager { } void disconnect() { + if (session == null) { + return; + } try { - if (session != null && session.getSessionState() != null) { + if (session.getSessionState() != null) { String clientId = session.getSessionState().getClientId(); if (clientId != null) CONNECTED_CLIENTS.remove(clientId);