summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-12-04 23:06:59 +0100
committerlouiz’ <louiz@louiz.org>2016-12-04 23:06:59 +0100
commiteb8f1cbc07aee0c22daa2ff4c24362c244327867 (patch)
tree0ca565035295dac1b3a96071fb1b2bfdb296633b
parent17f8cf64bd9246d1d23d45f0c6bc203f70a60113 (diff)
downloadbiboumi-eb8f1cbc07aee0c22daa2ff4c24362c244327867.tar.gz
biboumi-eb8f1cbc07aee0c22daa2ff4c24362c244327867.tar.bz2
biboumi-eb8f1cbc07aee0c22daa2ff4c24362c244327867.tar.xz
biboumi-eb8f1cbc07aee0c22daa2ff4c24362c244327867.zip
Avoid a potential nullptr dereference
-rw-r--r--src/xmpp/biboumi_component.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index ca24f3a..262596c 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -569,13 +569,11 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
Jid to(stanza.get_tag("to"));
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, {'#', '&'});
- 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 end;
const XmlNode* x = query->get_child("x", DATAFORM_NS);