Commit 7319e765 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Do not set key size or curve type to invalid values

Keep the current key size or curve type if the requested strength or
curve does not match any entry of the combo box.

GnuPG-bug-id: 5832
parent fe924fab
......@@ -80,7 +80,9 @@ static void set_keysize(QComboBox *cb, unsigned int strength)
return;
}
const int idx = cb->findData(static_cast<int>(strength));
cb->setCurrentIndex(idx);
if (idx >= 0) {
cb->setCurrentIndex(idx);
}
}
static unsigned int get_keysize(const QComboBox *cb)
......@@ -101,11 +103,9 @@ static void set_curve(QComboBox *cb, const QString &curve)
return;
}
const int idx = cb->findText(curve, Qt::MatchFixedString);
if (idx < 0) {
// Can't happen as we don't have them configurable.
qCWarning(KLEOPATRA_LOG) << "curve " << curve << " not allowed";
if (idx >= 0) {
cb->setCurrentIndex(idx);
}
cb->setCurrentIndex(idx);
}
static QString get_curve(const QComboBox *cb)
......
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