From 586846209b08ce5e9545f53f21de884eb4079115 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Thu, 11 Aug 2022 11:39:10 +0200 Subject: [PATCH] Qt: Fix working with no gpgconf in CryptoConfig * lang/qt/src/cryptoconfig.cpp (CryptoConfig::entry): Add nullptr checks. -- This fixes a crash when gpgconf is not found. When every return value is NULL. GnuPG-Bug-Id: T6131 --- lang/qt/src/cryptoconfig.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lang/qt/src/cryptoconfig.cpp b/lang/qt/src/cryptoconfig.cpp index 4f13d3f0..fe808827 100644 --- a/lang/qt/src/cryptoconfig.cpp +++ b/lang/qt/src/cryptoconfig.cpp @@ -56,10 +56,11 @@ QVariant CryptoConfigEntry::defaultValue() const QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &entryName) const { const CryptoConfigComponent *comp = component(componentName); - const QStringList groupNames = comp->groupList(); + const QStringList groupNames = comp ? comp->groupList() : QStringList(); for (const auto &groupName : groupNames) { - const CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr; - if (CryptoConfigEntry *entry = group->entry(entryName)) { + const CryptoConfigGroup *group = comp->group(groupName); + CryptoConfigEntry *entry = group ? group->entry(entryName) : nullptr; + if (entry) { return entry; } }