summary refs log tree commit diff
path: root/src/MxcImageProvider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MxcImageProvider.cpp')
-rw-r--r--src/MxcImageProvider.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp

index 0a91dde3..6098f0c4 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp
@@ -10,6 +10,7 @@ #include <mtxclient/crypto/client.hpp> #include <QByteArray> +#include <QCache> #include <QDir> #include <QFileInfo> #include <QPainter> @@ -103,6 +104,12 @@ MxcImageProvider::download(const QString &id, bool crop, double radius) { + if (id.isEmpty()) { + nhlog::net()->warn("Attempted to download image with empty ID"); + then(id, QSize{}, QImage{}, QString{}); + return; + } + std::optional<mtx::crypto::EncryptedFile> encryptionInfo; auto temp = infos.find("mxc://" + id); if (temp != infos.end()) @@ -264,6 +271,7 @@ MxcImageProvider::download(const QString &id, image.setText(QStringLiteral("original filename"), QString::fromStdString(originalFilename)); image.setText(QStringLiteral("mxc url"), "mxc://" + id); + then(id, requestedSize, image, fileInfo.absoluteFilePath()); return; } @@ -276,6 +284,7 @@ MxcImageProvider::download(const QString &id, image.setText(QStringLiteral("original filename"), QString::fromStdString(originalFilename)); image.setText(QStringLiteral("mxc url"), "mxc://" + id); + then(id, requestedSize, image, fileInfo.absoluteFilePath()); }); } catch (std::exception &e) {