Avoid a potential nullptr dereference

This commit is contained in:
louiz’
2016-12-04 23:06:59 +01:00
parent 17f8cf64bd
commit eb8f1cbc07
+2 -4
View File
@@ -569,13 +569,11 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
Jid to(stanza.get_tag("to")); Jid to(stanza.get_tag("to"));
const XmlNode* query = stanza.get_child("query", MAM_NS); const XmlNode* query = stanza.get_child("query", MAM_NS);
std::string query_id;
if (query)
query_id = query->get_tag("queryid");
Iid iid(to.local, {'#', '&'}); Iid iid(to.local, {'#', '&'});
if (iid.type == Iid::Type::Channel && to.resource.empty()) if (query && iid.type == Iid::Type::Channel && to.resource.empty())
{ {
const std::string query_id = query->get_tag("queryid");
std::string start; std::string start;
std::string end; std::string end;
const XmlNode* x = query->get_child("x", DATAFORM_NS); const XmlNode* x = query->get_child("x", DATAFORM_NS);