fixed npe with unsuccesfull bind
This commit is contained in:
parent
5182a92e58
commit
29f089c954
|
@ -609,25 +609,32 @@ public class XmppConnection implements Runnable {
|
||||||
this.sendUnboundIqPacket(iq, new OnIqPacketReceived() {
|
this.sendUnboundIqPacket(iq, new OnIqPacketReceived() {
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
String resource = packet.findChild("bind").findChild("jid")
|
Element bind = packet.findChild("bind");
|
||||||
.getContent().split("/")[1];
|
if (bind!=null) {
|
||||||
account.setResource(resource);
|
Element jid = bind.findChild("jid");
|
||||||
if (streamFeatures.hasChild("sm", "urn:xmpp:sm:3")) {
|
if (jid!=null) {
|
||||||
smVersion = 3;
|
account.setResource(jid.getContent().split("/")[1]);
|
||||||
EnablePacket enable = new EnablePacket(smVersion);
|
if (streamFeatures.hasChild("sm", "urn:xmpp:sm:3")) {
|
||||||
tagWriter.writeStanzaAsync(enable);
|
smVersion = 3;
|
||||||
} else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
|
EnablePacket enable = new EnablePacket(smVersion);
|
||||||
smVersion = 2;
|
tagWriter.writeStanzaAsync(enable);
|
||||||
EnablePacket enable = new EnablePacket(smVersion);
|
} else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
|
||||||
tagWriter.writeStanzaAsync(enable);
|
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);
|
||||||
}
|
}
|
||||||
sendServiceDiscoveryInfo(account.getServer());
|
|
||||||
sendServiceDiscoveryItems(account.getServer());
|
|
||||||
if (bindListener != null) {
|
|
||||||
bindListener.onBind(account);
|
|
||||||
}
|
|
||||||
|
|
||||||
changeStatus(Account.STATUS_ONLINE);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.streamFeatures.hasChild("session")) {
|
if (this.streamFeatures.hasChild("session")) {
|
||||||
|
|
Loading…
Reference in a new issue