aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2023-02-21 14:05:36 +0100
committerLinus Jahn <lnj@kaidan.im>2023-02-21 14:05:36 +0100
commit6779e8e077db4100996a01700418263048febcaf (patch)
tree599fa0c50c2e351dd4c70d17e767149793426700 /src
parent9a1969f8454c3799bdccaefc74e6bd556a866fc0 (diff)
downloadqxmpp-6779e8e077db4100996a01700418263048febcaf.tar.gz
OmemoManager: Fix deref of nullptr (wrong usage of get_if)
My fault.
Diffstat (limited to 'src')
-rw-r--r--src/omemo/QXmppOmemoManager_p.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/omemo/QXmppOmemoManager_p.cpp b/src/omemo/QXmppOmemoManager_p.cpp
index 485ef7b4..c6668e19 100644
--- a/src/omemo/QXmppOmemoManager_p.cpp
+++ b/src/omemo/QXmppOmemoManager_p.cpp
@@ -632,14 +632,17 @@ QXmppTask<bool> ManagerPrivate::setUpDeviceId()
// 2. There is an empty PubSub node for device bundles: XEP-0030 states that a server must
// respond with a node without included items.
auto error = std::get_if<QXmppError>(&result);
- if (auto stanzaErr = error->value<QXmppStanza::Error>()) {
- // allow Cancel|ItemNotFound here
- if (!(stanzaErr->type() == Error::Cancel && stanzaErr->condition() == Error::ItemNotFound)) {
- warning("Existing / Published device IDs could not be retrieved: " % errorToString(*error));
+ if (error) {
+ if (auto stanzaErr = error->value<QXmppStanza::Error>()) {
+ // allow Cancel|ItemNotFound here
+ if (!(stanzaErr->type() == Error::Cancel && stanzaErr->condition() == Error::ItemNotFound)) {
+ warning("Existing / Published device IDs could not be retrieved: " % errorToString(*error));
+ return false;
+ }
+ // do not return here
+ } else {
return false;
}
- } else {
- return false;
}
// The first generated device ID can be used if no device bundle node exists.