From ef7857ac8da2a5c604ff48620e2480e4aa52661f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 29 Oct 2015 14:38:35 +0100 Subject: avoid npe when checking for stream restart --- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 1549aeb5..04c0f625 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -360,7 +360,8 @@ public class XmppConnection implements Runnable { String.valueOf(saslMechanism.getPriority())); tagReader.reset(); sendStartStream(); - if (tagReader.readTag().isStart("stream")) { + final Tag tag = tagReader.readTag(); + if (tag != null && tag.isStart("stream")) { processStream(); } else { throw new IOException("server didn't restart stream after successful auth"); @@ -647,7 +648,8 @@ public class XmppConnection implements Runnable { sendStartStream(); Log.d(Config.LOGTAG, account.getJid().toBareJid()+ ": TLS connection established"); features.encryptionEnabled = true; - if (tagReader.readTag().isStart("stream")) { + final Tag tag = tagReader.readTag(); + if (tag != null && tag.isStart("stream")) { processStream(); } else { throw new IOException("server didn't restart stream after STARTTLS"); -- cgit v1.2.3