1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 06:45:59 +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,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.