fixed npe if roster jid couldnt be parsed

This commit is contained in:
iNPUTmice 2014-12-01 10:25:36 +01:00
parent 21f77cd1e3
commit 5992d4ac00

View file

@ -25,14 +25,11 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
} }
for (Element item : query.getChildren()) { for (Element item : query.getChildren()) {
if (item.getName().equals("item")) { if (item.getName().equals("item")) {
Jid jid; final Jid jid = item.getAttributeAsJid("jid");
try { if (jid == null) {
jid = Jid.fromString(item.getAttribute("jid")); break;
} catch (final InvalidJidException e) { }
// TODO: Handle this? String name = item.getAttribute("name");
jid = null;
}
String name = item.getAttribute("name");
String subscription = item.getAttribute("subscription"); String subscription = item.getAttribute("subscription");
Contact contact = account.getRoster().getContact(jid); Contact contact = account.getRoster().getContact(jid);
if (!contact.getOption(Contact.Options.DIRTY_PUSH)) { if (!contact.getOption(Contact.Options.DIRTY_PUSH)) {