From b9f8d4cfdd22db582dff32149f3725dc24cc2046 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 22 Aug 2024 17:29:39 +0200 Subject: [PATCH] Added a check for whether a text element has a width defined when the container property is set --- es-core/src/components/TextComponent.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index b202a78b5..f19820b52 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -641,7 +641,13 @@ void TextComponent::applyTheme(const std::shared_ptr& theme, } if (elem->has("container") && elem->get("container")) { - if (elem->has("containerType")) { + if (!elem->has("size") || (elem->has("size") && elem->get("size").x == 0.0f)) { + LOG(LogError) << "TextComponent: Invalid theme configuration, property " + "\"container\" for element \"" + << element.substr(5) + << "\" can't be used as a horizontal size has not been defined"; + } + else if (elem->has("containerType")) { const std::string& containerType {elem->get("containerType")}; if (containerType == "horizontal") { if (elem->has("containerScrollSpeed")) {