summary refs log tree commit diff
path: root/src/notifications/Manager.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/Manager.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/Manager.cpp')
-rw-r--r--src/notifications/Manager.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/notifications/Manager.cpp b/src/notifications/Manager.cpp

index 8a3576c5..b4a3a3da 100644 --- a/src/notifications/Manager.cpp +++ b/src/notifications/Manager.cpp
@@ -24,7 +24,7 @@ NotificationsManager::cacheImage(const mtx::events::collections::TimelineEvents http::client()->download( url, - [path, url, encryptionInfo](const std::string &data, + [&path, url, encryptionInfo](const std::string &data, const std::string &, const std::string &, mtx::http::RequestErr err) { @@ -53,10 +53,11 @@ NotificationsManager::cacheImage(const mtx::events::collections::TimelineEvents // resize the image QImage img{utils::readImage(QByteArray{temp.data()})}; - // make sure to save as PNG (because Plasma doesn't do JPEG in - // notifications) - // if (!file.fileName().endsWith(".png")) - // file.rename(file.fileName() + ".png"); + if (img.isNull()) + { + path.clear(); + return; + } #ifdef NHEKO_DBUS_SYS // the images in D-Bus notifications are to be 200x100 max img.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation)