kglobalaccel: correct check for invalid key sequences in keysFromString() function

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-27 23:15:27 +03:00
parent 7d79ee3af0
commit 57201e863c

View file

@ -41,8 +41,9 @@ static QList<int> keysFromString(const QString &str)
}
const QStringList strList = str.split('\t');
foreach (const QString &s, strList) {
int key = QKeySequence(s)[0];
if (key != -1) { //sanity check just in case
const int key = QKeySequence(s)[0];
if (key != 0) {
// sanity check just in case
ret.append(key);
}
}
@ -56,7 +57,7 @@ static QString stringFromKeys(const QList<int> &keys)
return QString::fromLatin1("none");
}
QString ret;
foreach (int key, keys) {
foreach (const int key, keys) {
ret.append(QKeySequence(key).toString());
ret.append('\t');
}