fixed npe when missing instructions on failed register

This commit is contained in:
Daniel Gultsch 2015-05-06 04:33:21 +02:00
parent db726a59b8
commit d74e8a8a0e

View file

@ -647,10 +647,8 @@ public class XmppConnection implements Runnable {
if (packet.query().hasChild("username") if (packet.query().hasChild("username")
&& (packet.query().hasChild("password"))) { && (packet.query().hasChild("password"))) {
final IqPacket register = new IqPacket(IqPacket.TYPE.SET); final IqPacket register = new IqPacket(IqPacket.TYPE.SET);
final Element username = new Element("username") final Element username = new Element("username").setContent(account.getUsername());
.setContent(account.getUsername()); final Element password = new Element("password").setContent(account.getPassword());
final Element password = new Element("password")
.setContent(account.getPassword());
register.query("jabber:iq:register").addChild(username); register.query("jabber:iq:register").addChild(username);
register.query().addChild(password); register.query().addChild(password);
sendIqPacket(register, new OnIqPacketReceived() { sendIqPacket(register, new OnIqPacketReceived() {
@ -677,7 +675,7 @@ public class XmppConnection implements Runnable {
disconnect(true); disconnect(true);
Log.d(Config.LOGTAG, account.getJid().toBareJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": could not register. instructions are" + ": could not register. instructions are"
+ instructions.getContent()); + instructions != null ? instructions.getContent() : "");
} }
} }
}); });