From 28629e0e7fa0ba8334e96a7b34f0de9a71b82c33 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 21 Aug 2014 12:02:32 +0200 Subject: [PATCH] Fix wrong boolean condition in async API inverse boolean condition, correct is: "if packetListener has been removed, then we received no response" and add check for exceptionCallback being null. --- .../java/org/jivesoftware/smack/AbstractXMPPConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 3f6f453a5..8dc187cc7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -1108,7 +1108,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @Override public void run() { boolean removed = removePacketListener(packetListener); - if (!removed) { + // If the packetListener got removed, then it was never run and + // we never received a response, inform the exception callback + if (removed && exceptionCallback != null) { exceptionCallback.processException(new NoResponseException()); } }