1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

SMACK-525 fix NPE when initConnection() fails

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_4_0@13862 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2014-01-17 10:40:10 +00:00 committed by flow
parent f155cb4d07
commit c143f0de25

View file

@ -1043,9 +1043,12 @@ public class XMPPConnection extends Connection {
*/ */
synchronized void notifyConnectionError(Exception e) { synchronized void notifyConnectionError(Exception e) {
// Listeners were already notified of the exception, return right here. // 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;
if (packetReader != null)
packetReader.done = true; packetReader.done = true;
if (packetWriter != null)
packetWriter.done = true; packetWriter.done = true;
// Closes the connection temporary. A reconnection is possible // Closes the connection temporary. A reconnection is possible
shutdown(new Presence(Presence.Type.unavailable)); shutdown(new Presence(Presence.Type.unavailable));