more npe checks in muc packet parser

This commit is contained in:
iNPUTmice 2014-11-13 14:27:10 +01:00
parent 88c8373553
commit e6a4fa031b

View file

@ -158,9 +158,10 @@ public class MucOptions {
String type = packet.getAttribute("type");
if (type == null) {
User user = new User();
Element item = packet.findChild("x",
"http://jabber.org/protocol/muc#user")
.findChild("item");
Element x = packet.findChild("x","http://jabber.org/protocol/muc#user");
if (x != null) {
Element item = x.findChild("item");
if (item != null) {
user.setName(name);
user.setAffiliation(item.getAttribute("affiliation"));
user.setRole(item.getAttribute("role"));
@ -180,8 +181,8 @@ public class MucOptions {
addUser(user);
}
if (pgp != null) {
Element x = packet.findChild("x", "jabber:x:signed");
if (x != null) {
Element signed = packet.findChild("x", "jabber:x:signed");
if (signed != null) {
Element status = packet.findChild("status");
String msg;
if (status != null) {
@ -190,7 +191,9 @@ public class MucOptions {
msg = "";
}
user.setPgpKeyId(pgp.fetchKeyId(account, msg,
x.getContent()));
signed.getContent()));
}
}
}
}
} else if (type.equals("unavailable") && name.equals(this.joinnick)) {