Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix crash when search clears while creating new entry #9230

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/gui/EntryPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,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 {};
}
11 changes: 6 additions & 5 deletions src/gui/Icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,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);
}
Expand All @@ -275,7 +274,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);
}
Expand All @@ -299,13 +297,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(" ");
Expand Down