fixed rare npe
This commit is contained in:
parent
59009ded82
commit
12c2fde61b
|
@ -259,32 +259,33 @@ public class MessageParser extends AbstractParser implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseNonMessage(Element packet, Account account) {
|
private void parseNonMessage(Element packet, Account account) {
|
||||||
|
String from = packet.getAttribute("from");
|
||||||
if (packet.hasChild("event", "http://jabber.org/protocol/pubsub#event")) {
|
if (packet.hasChild("event", "http://jabber.org/protocol/pubsub#event")) {
|
||||||
Element event = packet.findChild("event",
|
Element event = packet.findChild("event",
|
||||||
"http://jabber.org/protocol/pubsub#event");
|
"http://jabber.org/protocol/pubsub#event");
|
||||||
parseEvent(event, packet.getAttribute("from"), account);
|
parseEvent(event, packet.getAttribute("from"), account);
|
||||||
} else if (packet.hasChild("displayed", "urn:xmpp:chat-markers:0")) {
|
} else if (from != null
|
||||||
|
&& packet.hasChild("displayed", "urn:xmpp:chat-markers:0")) {
|
||||||
String id = packet
|
String id = packet
|
||||||
.findChild("displayed", "urn:xmpp:chat-markers:0")
|
.findChild("displayed", "urn:xmpp:chat-markers:0")
|
||||||
.getAttribute("id");
|
.getAttribute("id");
|
||||||
String[] fromParts = packet.getAttribute("from").split("/",2);
|
|
||||||
updateLastseen(packet, account, true);
|
updateLastseen(packet, account, true);
|
||||||
mXmppConnectionService.markMessage(account, fromParts[0], id,
|
mXmppConnectionService.markMessage(account, from.split("/", 2)[0],
|
||||||
Message.STATUS_SEND_DISPLAYED);
|
id, Message.STATUS_SEND_DISPLAYED);
|
||||||
} else if (packet.hasChild("received", "urn:xmpp:chat-markers:0")) {
|
} else if (from != null
|
||||||
|
&& packet.hasChild("received", "urn:xmpp:chat-markers:0")) {
|
||||||
String id = packet.findChild("received", "urn:xmpp:chat-markers:0")
|
String id = packet.findChild("received", "urn:xmpp:chat-markers:0")
|
||||||
.getAttribute("id");
|
.getAttribute("id");
|
||||||
String[] fromParts = packet.getAttribute("from").split("/",2);
|
|
||||||
updateLastseen(packet, account, false);
|
updateLastseen(packet, account, false);
|
||||||
mXmppConnectionService.markMessage(account, fromParts[0], id,
|
mXmppConnectionService.markMessage(account, from.split("/", 2)[0],
|
||||||
Message.STATUS_SEND_RECEIVED);
|
id, Message.STATUS_SEND_RECEIVED);
|
||||||
} else if (packet.hasChild("received", "urn:xmpp:receipts")) {
|
} else if (from != null
|
||||||
|
&& packet.hasChild("received", "urn:xmpp:receipts")) {
|
||||||
String id = packet.findChild("received", "urn:xmpp:receipts")
|
String id = packet.findChild("received", "urn:xmpp:receipts")
|
||||||
.getAttribute("id");
|
.getAttribute("id");
|
||||||
String[] fromParts = packet.getAttribute("from").split("/");
|
|
||||||
updateLastseen(packet, account, false);
|
updateLastseen(packet, account, false);
|
||||||
mXmppConnectionService.markMessage(account, fromParts[0], id,
|
mXmppConnectionService.markMessage(account, from.split("/", 2)[0],
|
||||||
Message.STATUS_SEND_RECEIVED);
|
id, Message.STATUS_SEND_RECEIVED);
|
||||||
} else if (packet.hasChild("x", "http://jabber.org/protocol/muc#user")) {
|
} else if (packet.hasChild("x", "http://jabber.org/protocol/muc#user")) {
|
||||||
Element x = packet.findChild("x",
|
Element x = packet.findChild("x",
|
||||||
"http://jabber.org/protocol/muc#user");
|
"http://jabber.org/protocol/muc#user");
|
||||||
|
|
Loading…
Reference in a new issue