diff --git a/source/org/jivesoftware/smack/XMPPConnection.java b/source/org/jivesoftware/smack/XMPPConnection.java index f442e7386..c775e52e4 100644 --- a/source/org/jivesoftware/smack/XMPPConnection.java +++ b/source/org/jivesoftware/smack/XMPPConnection.java @@ -1043,10 +1043,13 @@ public class XMPPConnection extends Connection { */ synchronized void notifyConnectionError(Exception e) { // Listeners were already notified of the exception, return right here. - if (packetReader.done && packetWriter.done) return; + if ((packetReader == null || packetReader.done) && + (packetWriter == null || packetWriter.done)) return; - packetReader.done = true; - packetWriter.done = true; + if (packetReader != null) + packetReader.done = true; + if (packetWriter != null) + packetWriter.done = true; // Closes the connection temporary. A reconnection is possible shutdown(new Presence(Presence.Type.unavailable)); // Notify connection listeners of the error.