Commit 4479581d authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Do not crash if there are no keys in the keyring

If there are no keys in the keyring, then we check the visibility
of the requesters before the dialog is shown on screen, i.e. before
the dialog is visible, so that isVisible() returns false even for
those requesters that were not explicitly set to "not visible". What
we actually want to find is not the first visible widget, but the
first widget that is not explicitly hidden. Therefore, we need to check
for !isHidden() instead of isVisible().

GnuPG-bug-id: 5535
parent 9f0ec8e0
Pipeline #75699 passed with stage
in 15 minutes and 47 seconds
......@@ -392,9 +392,9 @@ private Q_SLOTS:
mRequesters[SignEncryptFilesWizard::EncryptedPGP]->setVisible(!mUseOutputDir && sigKey.protocol() != Protocol::OpenPGP && pgp);
mRequesters[SignEncryptFilesWizard::SignaturePGP]->setVisible(!mUseOutputDir && sigKey.protocol() == Protocol::OpenPGP && !pgp);
mRequesters[SignEncryptFilesWizard::Directory]->setVisible(mUseOutputDir);
auto firstVisible = std::find_if(std::cbegin(mRequesters), std::cend(mRequesters),
[](auto w) { return w->isVisible(); });
mOutputLabel->setBuddy(*firstVisible);
auto firstNotHidden = std::find_if(std::cbegin(mRequesters), std::cend(mRequesters),
[](auto w) { return !w->isHidden(); });
mOutputLabel->setBuddy(*firstNotHidden);
} else {
mPlaceholderWidget->setVisible(true);
mOutputLabel->setVisible(false);
......
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