From de270d5283ac83de0eb7e9948fb3ed260df1ff94 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 16 Aug 2019 11:13:46 +0300 Subject: [PATCH] Fixed right action click handler on stickers without stickerpack. --- .../history/view/media/history_view_media_unwrapped.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp index 70c31b0ccc..33f744c747 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp @@ -278,13 +278,17 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const { auto fastShareTop = (fullBottom - st::historyFastShareBottom - st::historyFastShareSize); if (QRect(fastShareLeft, fastShareTop, st::historyFastShareSize, st::historyFastShareSize).contains(point)) { result.link = _parent->rightActionLink(); + return result; } } } auto pixLeft = usex + (usew - _contentSize.width()) / 2; auto pixTop = (minHeight() - _contentSize.height()) / 2; - if (QRect({ pixLeft, pixTop }, _contentSize).contains(point)) { + // Link of content can be nullptr (e.g. sticker without stickerpack). + // So we have to process it to avoid overriding the previous result. + if (_content->link() + && QRect({ pixLeft, pixTop }, _contentSize).contains(point)) { result.link = _content->link(); return result; }