From e096aef4e49280c0ecaf7f972676082d6dbd0576 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 16 Jan 2023 17:20:54 +0100 Subject: [PATCH] Fixed an issue where single-line scrollable containers could make the application hang. --- es-core/src/components/ScrollableContainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es-core/src/components/ScrollableContainer.cpp b/es-core/src/components/ScrollableContainer.cpp index 74cbb7250..75171b237 100644 --- a/es-core/src/components/ScrollableContainer.cpp +++ b/es-core/src/components/ScrollableContainer.cpp @@ -78,6 +78,8 @@ void ScrollableContainer::reset() if (mChildren.front()->getSize().y > mSize.y) { if (mVerticalSnap) { float numLines {std::floor(mSize.y / combinedHeight)}; + if (numLines == 0) + numLines = 1; mAdjustedHeight = std::round(numLines * combinedHeight); } else { @@ -145,6 +147,8 @@ void ScrollableContainer::update(int deltaTime) if (!mUpdatedSize) { if (mVerticalSnap) { float numLines {std::floor(mSize.y / combinedHeight)}; + if (numLines == 0) + numLines = 1; mAdjustedHeight = std::round(numLines * combinedHeight); } else {