From 762a611f2009e623d6291ae5564bcd5fa4602e3d Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Nov 2023 13:38:03 +0400 Subject: [PATCH] Fix possible std::clamp contract violation. --- ui/rp_widget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/rp_widget.h b/ui/rp_widget.h index 347963a..0cb7e6f 100644 --- a/ui/rp_widget.h +++ b/ui/rp_widget.h @@ -226,7 +226,7 @@ public: // Updates the area that is visible inside the scroll container. void setVisibleTopBottom(int visibleTop, int visibleBottom) { - auto max = height(); + const auto max = std::max(height(), 0); visibleTopBottomUpdated( std::clamp(visibleTop, 0, max), std::clamp(visibleBottom, 0, max));