From aea2c019de175c1ff64e5799d85c4faec3dc5af7 Mon Sep 17 00:00:00 2001 From: uramer Date: Tue, 29 Mar 2022 20:17:48 +0200 Subject: [PATCH] Fix content names for layouts inserted with :add() --- components/lua_ui/content.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/lua_ui/content.cpp b/components/lua_ui/content.cpp index 6f9cf61f2f..e7cf474bc9 100644 --- a/components/lua_ui/content.cpp +++ b/components/lua_ui/content.cpp @@ -44,11 +44,10 @@ namespace LuaUi void Content::insert(size_t index, const sol::table& table) { - size_t size = mOrdered.size(); - if (size < index) + if (mOrdered.size() < index) throw std::logic_error("Can't have gaps in UI Content."); mOrdered.insert(mOrdered.begin() + index, table); - for (size_t i = index; i < size; ++i) + for (size_t i = index; i < mOrdered.size(); ++i) { sol::optional name = mOrdered[i]["name"]; if (name.has_value())