mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-27 06:47:02 -05:00
Fix crash when search clears while creating new entry
* Fixes #7660 * Also fix code error in Icons::imageFormatsFilter. An inner loop looks for invalid characters in the code point, but erroneously calls `continue` within the inner loop when the intention was to continue in the outer loop. Fixed with a boolean test instead.
This commit is contained in:
parent
6b51c66c68
commit
6c9078c870
@ -567,6 +567,9 @@ void EntryPreviewWidget::setTabEnabled(QTabWidget* tabWidget, QWidget* widget, b
|
||||
|
||||
QString EntryPreviewWidget::hierarchy(const Group* group, const QString& title)
|
||||
{
|
||||
QString groupList = QString("%1").arg(group->hierarchy().join(" / "));
|
||||
return title.isEmpty() ? groupList : QString("%1 / %2").arg(groupList, title);
|
||||
if (group) {
|
||||
QString groupList = QString("%1").arg(group->hierarchy().join(" / "));
|
||||
return title.isEmpty() ? groupList : QString("%1 / %2").arg(groupList, title);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -258,7 +258,6 @@ QPixmap Icons::entryIconPixmap(const Entry* entry, IconSize size)
|
||||
if (entry->iconUuid().isNull()) {
|
||||
icon = databaseIcons()->icon(entry->iconNumber(), size);
|
||||
} else {
|
||||
Q_ASSERT(entry->database());
|
||||
if (entry->database()) {
|
||||
icon = Icons::customIconPixmap(entry->database(), entry->iconUuid(), size);
|
||||
}
|
||||
@ -277,7 +276,6 @@ QPixmap Icons::groupIconPixmap(const Group* group, IconSize size)
|
||||
if (group->iconUuid().isNull()) {
|
||||
icon = databaseIcons()->icon(group->iconNumber(), size);
|
||||
} else {
|
||||
Q_ASSERT(group->database());
|
||||
if (group->database()) {
|
||||
icon = Icons::customIconPixmap(group->database(), group->iconUuid(), size);
|
||||
}
|
||||
@ -301,13 +299,16 @@ QString Icons::imageFormatsFilter()
|
||||
QStringList formatsStringList;
|
||||
|
||||
for (const QByteArray& format : formats) {
|
||||
bool codePointClean = true;
|
||||
for (char codePoint : format) {
|
||||
if (!QChar(codePoint).isLetterOrNumber()) {
|
||||
continue;
|
||||
codePointClean = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
formatsStringList.append("*." + QString::fromLatin1(format).toLower());
|
||||
if (codePointClean) {
|
||||
formatsStringList.append("*." + QString::fromLatin1(format).toLower());
|
||||
}
|
||||
}
|
||||
|
||||
return formatsStringList.join(" ");
|
||||
|
Loading…
x
Reference in New Issue
Block a user