From f0c4eb7caad5535ddf295e078300915670153e73 Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 10 Jun 2023 12:11:05 +0200 Subject: [PATCH] Fix undefined behaviour when loading non-existant credentials (#4674) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/common/Credentials.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3d2090a..eaeb94f58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Dev: Added tools to help debug image GC. (#4578) - Dev: Removed duplicate license when having plugins enabled. (#4665) - Dev: Replace our QObjectRef class with Qt's QPointer class. (#4666) +- Dev: Fixed undefined behavior when loading non-existant credentials. (#4673) ## 2.4.4 diff --git a/src/common/Credentials.cpp b/src/common/Credentials.cpp index f3985701f..d3bb5ebbd 100644 --- a/src/common/Credentials.cpp +++ b/src/common/Credentials.cpp @@ -197,9 +197,9 @@ void Credentials::get(const QString &provider, const QString &name_, } else { - auto &instance = insecureInstance(); + const auto &instance = insecureInstance(); - onLoaded(instance.object().find(name).value().toString()); + onLoaded(instance[name].toString()); } }