From c5f09bbf695e1dff80f378bb5907581f65547f9f Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 27 Dec 2022 13:53:44 +0400 Subject: [PATCH] Fix assertion violation in GenericBox. --- ui/layers/generic_box.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/layers/generic_box.cpp b/ui/layers/generic_box.cpp index e6ff6af..380f172 100644 --- a/ui/layers/generic_box.cpp +++ b/ui/layers/generic_box.cpp @@ -28,14 +28,17 @@ void GenericBox::prepare() { pinned ? pinned->heightValue() : rpl::single(0), wrap->heightValue() ) | rpl::start_with_next([=](int top, int height) { + Expects(_minHeight >= 0); + Expects(!_maxHeight || _minHeight <= _maxHeight); + setInnerTopSkip(top); const auto desired = top + height; setDimensions( currentWidth, std::clamp( desired, - _minHeight ? _minHeight : desired, - _maxHeight ? _maxHeight : desired), + _minHeight, + _maxHeight ? _maxHeight : std::max(_minHeight, desired)), true); }, wrap->lifetime());