From fcb0c5872e5a3b530f2407547084c801e4e4b402 Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Mon, 25 Dec 2023 14:25:33 +0100 Subject: [PATCH] Fixed crash that could occur in ListView when it's size was near 0 --- src/Widgets/ListView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widgets/ListView.cpp b/src/Widgets/ListView.cpp index 0ac7f1a50..bb7eb8324 100644 --- a/src/Widgets/ListView.cpp +++ b/src/Widgets/ListView.cpp @@ -2742,7 +2742,7 @@ namespace tgui if (m_horizontalScrollbar->isShown()) { m_verticalScrollbar->setSize({m_verticalScrollbar->getSize().x, std::max(0.f, getInnerSize().y) - m_horizontalScrollbar->getSize().y}); - m_verticalScrollbar->setViewportSize(static_cast(innerSize.y - m_horizontalScrollbar->getSize().y)); + m_verticalScrollbar->setViewportSize(static_cast(std::max(0.f, innerSize.y - m_horizontalScrollbar->getSize().y))); } else { @@ -2753,7 +2753,7 @@ namespace tgui if (m_verticalScrollbar->isShown()) { m_horizontalScrollbar->setSize({getInnerSize().x - m_verticalScrollbar->getSize().x, m_horizontalScrollbar->getSize().y}); - m_horizontalScrollbar->setViewportSize(static_cast(innerSize.x - m_verticalScrollbar->getSize().x)); + m_horizontalScrollbar->setViewportSize(static_cast(std::max(0.f, innerSize.x - m_verticalScrollbar->getSize().x))); } else {