diff options
author | Marvin W <git@larma.de> | 2019-12-22 04:10:53 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2019-12-23 16:58:53 +0100 |
commit | a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d (patch) | |
tree | cbb079649066c2001b6d6881137108e70eed9d3f /xmpp-vala/src/module/roster | |
parent | 3218dc0211ac717230fe03fad82681a626d968b5 (diff) | |
download | dino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.tar.gz dino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.zip |
Properly check Jids everywhere
Diffstat (limited to 'xmpp-vala/src/module/roster')
-rw-r--r-- | xmpp-vala/src/module/roster/item.vala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xmpp-vala/src/module/roster/item.vala b/xmpp-vala/src/module/roster/item.vala index 2fbf03ef..78974a35 100644 --- a/xmpp-vala/src/module/roster/item.vala +++ b/xmpp-vala/src/module/roster/item.vala @@ -17,8 +17,15 @@ public class Item { public StanzaNode stanza_node; private Jid jid_; - public Jid jid { - get { return jid_ ?? (jid_ = Jid.parse(stanza_node.get_attribute(NODE_JID))); } + public Jid? jid { + get { + try { + return jid_ ?? (jid_ = new Jid(stanza_node.get_attribute(NODE_JID))); + } catch (InvalidJidError e) { + warning("Ignoring invalid Jid in roster entry: %s", e.message); + return null; + } + } set { stanza_node.set_attribute(NODE_JID, value.to_string()); } } |