From a755fa391edad68951142a0fcc034df695a007ca Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 4 Oct 2022 19:34:10 +0400 Subject: [PATCH] Fix crash in toasts. --- ui/toast/toast_widget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/toast/toast_widget.cpp b/ui/toast/toast_widget.cpp index 9f9c861..6d3981b 100644 --- a/ui/toast/toast_widget.cpp +++ b/ui/toast/toast_widget.cpp @@ -40,10 +40,12 @@ Widget::Widget(QWidget *parent, const Config &config) _multiline ? config.text : TextUtilities::SingleLine(config.text), toastOptions, config.textContext ? config.textContext(this) : std::any()); - const auto weak = Ui::MakeWeak(this); - _text.setSpoilerLinkFilter([=](const ClickContext &context) { - return (weak != nullptr); - }); + if (_text.hasSpoilers()) { + const auto weak = Ui::MakeWeak(this); + _text.setSpoilerLinkFilter([=](const ClickContext &context) { + return (weak != nullptr); + }); + } _processMouse = _text.hasLinks() || _text.hasSpoilers(); if (_processMouse) {