From 919e067ab7a6f2f07422cb23c916f63348c4af58 Mon Sep 17 00:00:00 2001 From: uramer Date: Sat, 11 Nov 2023 13:46:16 +0100 Subject: [PATCH] Error when encountering destroyed widgets --- components/lua_ui/element.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/lua_ui/element.cpp b/components/lua_ui/element.cpp index 996ba67bb4..dc8f2e6175 100644 --- a/components/lua_ui/element.cpp +++ b/components/lua_ui/element.cpp @@ -113,6 +113,8 @@ namespace LuaUi std::shared_ptr element = child.as>(); if (ext != element->mRoot) destroyChild(ext); + if (!element->mRoot) + throw std::logic_error("Using a destroyed element as a layout child"); result[i] = element->mRoot; element->mRoot->updateCoord(); } @@ -139,6 +141,8 @@ namespace LuaUi if (child.is()) { std::shared_ptr element = child.as>(); + if (!element->mRoot) + throw std::logic_error("Using a destroyed element as a layout child"); result[i] = element->mRoot; element->mRoot->updateCoord(); }