From abcf55c4987cd494bd0ab95ca7288e7d48f26690 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 16 Apr 2024 11:31:38 +0400 Subject: [PATCH] Check chat background read result. --- Telegram/SourceFiles/ui/chat/chat_theme.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/chat/chat_theme.cpp b/Telegram/SourceFiles/ui/chat/chat_theme.cpp index 1022f8e56b..4979e5c4ad 100644 --- a/Telegram/SourceFiles/ui/chat/chat_theme.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_theme.cpp @@ -909,12 +909,17 @@ QImage PrepareImageForTiled(const QImage &prepared) { const QString &path, const QByteArray &content, bool gzipSvg) { - return Images::Read({ + auto result = Images::Read({ .path = path, .content = content, .maxSize = QSize(kMaxSize, kMaxSize), .gzipSvg = gzipSvg, }).image; + if (result.isNull()) { + result = QImage(1, 1, QImage::Format_ARGB32_Premultiplied); + result.fill(Qt::black); + } + return result; } QImage GenerateBackgroundImage(