diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-13 14:27:10 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-13 14:27:10 +0100 |
commit | e6a4fa031b28437e0c237b3c23102f42f9b5c769 (patch) | |
tree | a44567378504105e015c1d96bf69010da278ad28 | |
parent | 88c8373553ac8527a1b1e6225d31cb2dde84d403 (diff) |
more npe checks in muc packet parser
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/MucOptions.java | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index e25c6b89..6eb1d43c 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -158,39 +158,42 @@ 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"); - user.setName(name); - user.setAffiliation(item.getAttribute("affiliation")); - user.setRole(item.getAttribute("role")); - user.setJid(item.getAttribute("jid")); - user.setName(name); - if (name.equals(this.joinnick)) { - this.isOnline = true; - this.error = ERROR_NO_ERROR; - self = user; - if (aboutToRename) { - if (renameListener != null) { - renameListener.onRename(true); - } - aboutToRename = false; - } - } else { - addUser(user); - } - if (pgp != null) { - Element x = packet.findChild("x", "jabber:x:signed"); - if (x != null) { - Element status = packet.findChild("status"); - String msg; - if (status != null) { - msg = status.getContent(); + 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")); + user.setJid(item.getAttribute("jid")); + user.setName(name); + if (name.equals(this.joinnick)) { + this.isOnline = true; + this.error = ERROR_NO_ERROR; + self = user; + if (aboutToRename) { + if (renameListener != null) { + renameListener.onRename(true); + } + aboutToRename = false; + } } else { - msg = ""; + addUser(user); + } + if (pgp != null) { + Element signed = packet.findChild("x", "jabber:x:signed"); + if (signed != null) { + Element status = packet.findChild("status"); + String msg; + if (status != null) { + msg = status.getContent(); + } else { + msg = ""; + } + user.setPgpKeyId(pgp.fetchKeyId(account, msg, + signed.getContent())); + } } - user.setPgpKeyId(pgp.fetchKeyId(account, msg, - x.getContent())); } } } else if (type.equals("unavailable") && name.equals(this.joinnick)) { |