From 3af2bf61fe5da4c70d61fca9bfb6bbbfdec5a992 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 6 Apr 2026 12:24:28 +0300 Subject: [PATCH] Fixed tooltip crash when top peers selector widget has small width. --- .../history/view/history_view_top_peers_selector.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_top_peers_selector.cpp b/Telegram/SourceFiles/history/view/history_view_top_peers_selector.cpp index 50644eea78..63da74acd6 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_peers_selector.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_peers_selector.cpp @@ -90,10 +90,11 @@ void ShowTopPeersSelector( const auto contentHeight = int( st::topPeersSelectorUserpicSize * (1. + st::topPeersSelectorUserpicExpand)); - const auto selectorWidth = contentWidth - + 2 * st::topPeersSelectorPadding; const auto selectorHeight = contentHeight + 2 * st::topPeersSelectorPadding; + const auto selectorWidth = (peers.size() == 1) + ? selectorHeight + : (contentWidth + 2 * st::topPeersSelectorPadding); struct State { base::unique_qptr selector; @@ -159,7 +160,10 @@ void ShowTopPeersSelector( peers[info.index]->isSelf() ? tr::lng_saved_messages(tr::rich) : NameValue(peers[info.index]) | rpl::map(tr::rich), - userpicsWidget->width(), + std::max( + userpicsWidget->width(), + st::topPeersSelectorImportantTooltipLabel.minWidth + + st::lineWidth), st::topPeersSelectorImportantTooltipLabel), st::topPeersSelectorImportantTooltip.padding), st::topPeersSelectorImportantTooltip);