aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0030_service_discovery
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-25 16:12:08 +0200
committerfiaxh <git@lightrise.org>2020-04-25 16:15:43 +0200
commitee9795d8f466706e06b2fdbc9beca2f8ecbf5d08 (patch)
tree17f4ecdf43e0fe031e220d58d0cade7b70711440 /xmpp-vala/src/module/xep/0030_service_discovery
parent231df1bbbb683fa0c74f2f10743f7592e219eccd (diff)
downloaddino-ee9795d8f466706e06b2fdbc9beca2f8ecbf5d08.tar.gz
dino-ee9795d8f466706e06b2fdbc9beca2f8ecbf5d08.zip
Handle if Items/InfoResult are null
Diffstat (limited to 'xmpp-vala/src/module/xep/0030_service_discovery')
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala4
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/module.vala6
2 files changed, 7 insertions, 3 deletions
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala b/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
index 233a0c06..105da893 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
@@ -26,6 +26,10 @@ public class ItemsResult {
}
public static ItemsResult? create_from_iq(Iq.Stanza iq) {
+ if (iq.type_ != Iq.Stanza.TYPE_RESULT) return null;
+
+ if (iq.stanza.get_subnode("query", NS_URI_ITEMS) == null) return null;
+
return new ItemsResult.from_iq(iq);
}
}
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
index 708d5311..f21146f1 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
@@ -46,11 +46,11 @@ public class Module : XmppStreamModule, Iq.Handler {
if (flag.has_entity_feature(jid, feature) == null) {
InfoResult? info_result = yield request_info(stream, jid);
- stream.get_flag(Flag.IDENTITY).set_entity_features(info_result.iq.from, info_result != null ? info_result.features : null);
- stream.get_flag(Flag.IDENTITY).set_entity_identities(info_result.iq.from, info_result != null ? info_result.identities : null);
+ stream.get_flag(Flag.IDENTITY).set_entity_features(jid, info_result != null ? info_result.features : null);
+ stream.get_flag(Flag.IDENTITY).set_entity_identities(jid, info_result != null ? info_result.identities : null);
}
- return flag.has_entity_feature(jid, feature);
+ return flag.has_entity_feature(jid, feature) ?? false;
}
public async Gee.Set<Identity>? get_entity_identities(XmppStream stream, Jid jid) {