Fix possible std::clamp contract violation.

This commit is contained in:
John Preston 2023-11-06 13:38:03 +04:00
parent 65310f32dc
commit 762a611f20

View file

@ -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));