summary refs log tree commit diff
path: root/src/notifications/ManagerLinux.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-03-01 20:07:53 -0500
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-17 19:18:06 +0100
commit64dd10a6a0066dc209196819534cc54c89628f33 (patch)
treefec60ac06dfa4faf3b3fcb33b98083b7edca6378 /src/notifications/ManagerLinux.cpp
parentUse better method of resizing images (diff)
downloadnheko-64dd10a6a0066dc209196819534cc54c89628f33.tar.xz
Only try to display images if they exist
Diffstat (limited to 'src/notifications/ManagerLinux.cpp')
-rw-r--r--src/notifications/ManagerLinux.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp

index cd9d6fb8..0cf61d5c 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp
@@ -216,12 +216,18 @@ NotificationsManager::formatNotification(const mtx::responses::Notification &not if (hasMarkup_) { if (hasImages_ && mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image) + { + QString imgPath = cacheImage(notification.event); + if (imgPath.isNull()) + return mtx::accessors::formattedBodyWithFallback(notification.event).prepend(messageLeadIn); + else return QString( - "<img src=\"file:///" + cacheImage(notification.event) + + "<img src=\"file:///" + imgPath + "\" alt=\"" + mtx::accessors::formattedBodyWithFallback(notification.event) + "\">") .prepend(messageLeadIn); + } return mtx::accessors::formattedBodyWithFallback(notification.event) .prepend(messageLeadIn)