From 827bcc0c90af471315b9905fc2d9e42b7e248300 Mon Sep 17 00:00:00 2001 From: Andrei Sebastian <61626661+skuzzis@users.noreply.github.com> Date: Fri, 3 Oct 2025 17:04:23 +0300 Subject: [PATCH 1/2] fix(entitybrowser): Null GameEntitySystem --- src/imgui/panels/entitybrowser/entitybrowser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/imgui/panels/entitybrowser/entitybrowser.cpp b/src/imgui/panels/entitybrowser/entitybrowser.cpp index 9359e1c..c5a7d96 100644 --- a/src/imgui/panels/entitybrowser/entitybrowser.cpp +++ b/src/imgui/panels/entitybrowser/entitybrowser.cpp @@ -55,6 +55,12 @@ void Draw(bool* isOpen) if (ImGui::BeginTable("Entity Table", 2)) { + if (GameEntitySystem() == nullptr) { + ImGui::EndTable(); + ImGui::EndChild(); + ImGui::End(); + return; + } ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Entity Index"); ImGui::TableHeadersRow(); From 99d28619f412387480bddeb78d5368a80ef07cbe Mon Sep 17 00:00:00 2001 From: Andrei Sebastian <61626661+skuzzis@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:56:33 +0300 Subject: [PATCH 2/2] chore(entitybrowser): Wrap entity iteration loop --- .../panels/entitybrowser/entitybrowser.cpp | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/imgui/panels/entitybrowser/entitybrowser.cpp b/src/imgui/panels/entitybrowser/entitybrowser.cpp index c5a7d96..ae6664f 100644 --- a/src/imgui/panels/entitybrowser/entitybrowser.cpp +++ b/src/imgui/panels/entitybrowser/entitybrowser.cpp @@ -55,33 +55,29 @@ void Draw(bool* isOpen) if (ImGui::BeginTable("Entity Table", 2)) { - if (GameEntitySystem() == nullptr) { - ImGui::EndTable(); - ImGui::EndChild(); - ImGui::End(); - return; - } ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Entity Index"); ImGui::TableHeadersRow(); EntityInstanceIter_t iter; - - while (CEntityInstance* entity = iter.Next()) + if(GameEntitySystem()) { - if (!g_menuContext.m_entityFilter.PassFilter(entity->GetClassname())) - continue; - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - ImGui::PushID(entity->GetEntityIndex().Get()); - if (ImGui::Selectable(entity->GetClassname(), false, ImGuiSelectableFlags_SpanAllColumns)) + while (CEntityInstance* entity = iter.Next()) { - g_pSelectedEntity = entity->GetRefEHandle(); + if (!g_menuContext.m_entityFilter.PassFilter(entity->GetClassname())) + continue; + + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::PushID(entity->GetEntityIndex().Get()); + if (ImGui::Selectable(entity->GetClassname(), false, ImGuiSelectableFlags_SpanAllColumns)) + { + g_pSelectedEntity = entity->GetRefEHandle(); + } + ImGui::PopID(); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%d", entity->GetEntityIndex()); } - ImGui::PopID(); - ImGui::TableSetColumnIndex(1); - ImGui::Text("%d", entity->GetEntityIndex()); } ImGui::EndTable();