diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-03-22 14:22:42 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-03-22 14:22:42 +0100 |
commit | 31a83c515e115170a0e9c31783d94b48e6b62d15 (patch) | |
tree | 6840a0d9be3e7a83adceedf1d81293139f898e11 | |
parent | Merge pull request #154 from adasauce/image-modal-download (diff) | |
download | nheko-31a83c515e115170a0e9c31783d94b48e6b62d15.tar.xz |
Fix broken avatars in quick switcher
-rw-r--r-- | src/popups/PopupItem.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/popups/PopupItem.cpp b/src/popups/PopupItem.cpp index db97e4a3..5513f942 100644 --- a/src/popups/PopupItem.cpp +++ b/src/popups/PopupItem.cpp @@ -113,7 +113,8 @@ RoomItem::RoomItem(QWidget *parent, const RoomSearchResult &res) topLayout_->addWidget(avatar_); topLayout_->addWidget(roomName_, 1); - avatar_->setImage(QString::fromStdString(res.info.avatar_url)); + if (!res.info.avatar_url.empty()) + avatar_->setImage(QString::fromStdString(res.info.avatar_url)); } void @@ -128,7 +129,11 @@ RoomItem::updateItem(const RoomSearchResult &result) roomName_->setText(name); - avatar_->setImage(QString::fromStdString(result.info.avatar_url)); + // if there is not an avatar set for the room, we want to at least show the letter + // correctly! + avatar_->setLetter(utils::firstChar(name)); + if (!result.info.avatar_url.empty()) + avatar_->setImage(QString::fromStdString(result.info.avatar_url)); } void |