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
This commit is contained in:
Andre Heinecke 2022-08-11 11:39:10 +02:00
parent 7e2ef54b9c
commit 586846209b
No known key found for this signature in database
GPG Key ID: EF20562ABF3290E6

View File

@ -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;
}
}