aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-26 15:44:32 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-26 15:44:32 +0200
commit29f089c95468357e92c104dd693277f583c77d79 (patch)
treea85e084f4b6bcf0be0dbfef8f6f92c823c0c3726 /src/eu/siacs/conversations
parent5182a92e58d7832eb0fe5677192c8765a7df956a (diff)
fixed npe with unsuccesfull bind
Diffstat (limited to 'src/eu/siacs/conversations')
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index 45bac2f6..f335d9d4 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -609,25 +609,32 @@ public class XmppConnection implements Runnable {
this.sendUnboundIqPacket(iq, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
- String resource = packet.findChild("bind").findChild("jid")
- .getContent().split("/")[1];
- account.setResource(resource);
- if (streamFeatures.hasChild("sm", "urn:xmpp:sm:3")) {
- smVersion = 3;
- EnablePacket enable = new EnablePacket(smVersion);
- tagWriter.writeStanzaAsync(enable);
- } else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
- smVersion = 2;
- EnablePacket enable = new EnablePacket(smVersion);
- tagWriter.writeStanzaAsync(enable);
- }
- sendServiceDiscoveryInfo(account.getServer());
- sendServiceDiscoveryItems(account.getServer());
- if (bindListener != null) {
- bindListener.onBind(account);
+ Element bind = packet.findChild("bind");
+ if (bind!=null) {
+ Element jid = bind.findChild("jid");
+ if (jid!=null) {
+ account.setResource(jid.getContent().split("/")[1]);
+ if (streamFeatures.hasChild("sm", "urn:xmpp:sm:3")) {
+ smVersion = 3;
+ EnablePacket enable = new EnablePacket(smVersion);
+ tagWriter.writeStanzaAsync(enable);
+ } else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
+ smVersion = 2;
+ EnablePacket enable = new EnablePacket(smVersion);
+ tagWriter.writeStanzaAsync(enable);
+ }
+ sendServiceDiscoveryInfo(account.getServer());
+ sendServiceDiscoveryItems(account.getServer());
+ if (bindListener != null) {
+ bindListener.onBind(account);
+ }
+ changeStatus(Account.STATUS_ONLINE);
+ } else {
+ disconnect(true);
+ }
+ } else {
+ disconnect(true);
}
-
- changeStatus(Account.STATUS_ONLINE);
}
});
if (this.streamFeatures.hasChild("session")) {