From f3ed7c5e1990a1cc2a0115d2326268bb759b79db Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Feb 2025 16:27:03 +0400 Subject: [PATCH] Fix crash in Instant View in some themes. Fixes #28604. --- Telegram/SourceFiles/ui/webview_helpers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/ui/webview_helpers.cpp b/Telegram/SourceFiles/ui/webview_helpers.cpp index 01cd56cb4..e68f19e85 100644 --- a/Telegram/SourceFiles/ui/webview_helpers.cpp +++ b/Telegram/SourceFiles/ui/webview_helpers.cpp @@ -101,9 +101,9 @@ QByteArray ComputeSemiTransparentOverStyle( const auto gmina = mina(g0, g1); const auto bmina = mina(b0, b1); const auto a = std::max({ rmina, gmina, bmina }); - const auto r = (r1 * 255 - r0 * (255 - a)) / a; - const auto g = (g1 * 255 - g0 * (255 - a)) / a; - const auto b = (b1 * 255 - b0 * (255 - a)) / a; + const auto r = (a > 0) ? ((r1 * 255 - r0 * (255 - a)) / a) : r0; + const auto g = (a > 0) ? ((g1 * 255 - g0 * (255 - a)) / a) : g0; + const auto b = (a > 0) ? ((b1 * 255 - b0 * (255 - a)) / a) : b0; return result(QColor(r, g, b, a)); }