From 2c26dcc6105269d9d895e6ed93e786ef1dd81617 Mon Sep 17 00:00:00 2001 From: nester Date: Sat, 28 Jul 2018 17:03:51 +0800 Subject: [PATCH] Fixed Issue #307 NPE Signed-off-by: nester --- .../org/eclipse/paho/android/service/MqttConnection.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttConnection.java b/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttConnection.java index 28bf7c10..fa8047ce 100755 --- a/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttConnection.java +++ b/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttConnection.java @@ -176,11 +176,10 @@ public void connect(MqttConnectOptions options, String invocationContext, String if (options != null) { cleanSession = options.isCleanSession(); - } - - if (connectOptions.isCleanSession()) { // if it's a clean session, - // discard old data - service.messageStore.clearArrivedMessages(clientHandle); + if (options.isCleanSession()) { // if it's a clean session, + // discard old data + service.messageStore.clearArrivedMessages(clientHandle); + } } service.traceDebug(TAG, "Connecting {" + serverURI + "} as {" + clientId + "}");