Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/ddeintegration/appmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ static AppMgr::AppItem *parseDBus2AppItem(const ObjectInterfaceMap &source)
parseDBusField<QStringMap>(appInfo, u8"Name").value(),
parseDBusField<QStringMap>(appInfo, u8"GenericName").value());

// just in case the entry is ill-formed, doesn't have a valid display name, fallback to use its desktop-id instead.
if (item->displayName.isEmpty()) {
item->displayName = item->id;
}
Comment on lines +97 to +100
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Treat whitespace-only display names as empty before applying the desktop-id fallback.

Because this uses isEmpty(), a display name containing only spaces or other whitespace will not fall back and will likely render poorly. Please use item->displayName.trimmed().isEmpty() so whitespace-only values also trigger the desktop-id fallback.

Suggested change
// just in case the entry is ill-formed, doesn't have a valid display name, fallback to use its desktop-id instead.
if (item->displayName.isEmpty()) {
item->displayName = item->id;
}
// just in case the entry is ill-formed, doesn't have a valid display name (or only whitespace),
// fallback to use its desktop-id instead.
if (item->displayName.trimmed().isEmpty()) {
item->displayName = item->id;
}


if (auto value = parseDBusField<QStringMap>(appInfo, u8"Name")) {
item->name = parseName(value.value());
}
Expand Down