Commit 09c7841a authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Handle NULL config and invalid component names

parent b1331000
......@@ -21,13 +21,19 @@ using namespace QGpgME;
QGpgME::CryptoConfigEntry *Kleo::getCryptoConfigEntry(const CryptoConfig *config, const char *componentName, const char *entryName)
if (!config) {
return nullptr;
return config->entry(QString::fromLatin1(componentName), QString::fromLatin1(entryName));
const CryptoConfigComponent *const comp = config->component(QString::fromLatin1(componentName));
if (!comp) {
return nullptr;
const QStringList groupNames = comp->groupList();
for (const auto &groupName : groupNames) {
const CryptoConfigGroup *const group = comp ? comp->group(groupName) : nullptr;
const CryptoConfigGroup *const group = comp->group(groupName);
if (CryptoConfigEntry *const entry = group->entry(QString::fromLatin1(entryName))) {
return entry;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment