fixed potential NPEs

This commit is contained in:
iNPUTmice 2014-11-20 18:42:47 +01:00
parent a142dcc263
commit a207240881

View file

@ -344,8 +344,13 @@ public class MessageParser extends AbstractParser implements
private void parseEvent(final Element event, final Jid from, final Account account) { private void parseEvent(final Element event, final Jid from, final Account account) {
Element items = event.findChild("items"); Element items = event.findChild("items");
if (items == null) {
return;
}
String node = items.getAttribute("node"); String node = items.getAttribute("node");
if (node != null) { if (node == null) {
return;
}
if (node.equals("urn:xmpp:avatar:metadata")) { if (node.equals("urn:xmpp:avatar:metadata")) {
Avatar avatar = Avatar.parseMetadata(items); Avatar avatar = Avatar.parseMetadata(items);
if (avatar != null) { if (avatar != null) {
@ -392,7 +397,6 @@ public class MessageParser extends AbstractParser implements
} }
} }
} }
}
private String getPgpBody(Element message) { private String getPgpBody(Element message) {
Element child = message.findChild("x", "jabber:x:encrypted"); Element child = message.findChild("x", "jabber:x:encrypted");