From eccc5095fb25e6e6b491e54998998ddc38f185a9 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 13 Aug 2024 21:41:17 +0200 Subject: [PATCH] Fixed an issue where ComponentList could generate elements with negative widths --- es-core/src/components/ComponentList.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index 44ddc91ad..84459f31f 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -382,6 +382,10 @@ void ComponentList::updateElementSize(const ComponentListRow& row) width -= it->component->getSize().x; } + // This can happen if the element has zero width, or close to zero width. + if (width < 0.0f) + width = 0.0f; + // Redistribute the "unused" width equally among the components if resizeWidth is set to true. width = width / resizeVec.size(); for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); ++it)