From 4491614a0deb709981c99678a72924e4c11daad4 Mon Sep 17 00:00:00 2001 From: Arnaud Jamin Date: Thu, 16 Jan 2025 19:28:20 -0500 Subject: [PATCH] CogEngine: Fix crash with new cheat window when no asset defined minor: rework cheat filters --- .../Private/CogEngineWindow_Cheats.cpp | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp index 0e7cc21..6eec55d 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp @@ -59,6 +59,9 @@ void FCogEngineWindow_Cheats::Initialize() })); + if (Asset == nullptr) + { return; } + for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories) { for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) @@ -219,22 +222,7 @@ void FCogEngineWindow_Cheats::RenderContent() ImGui::SetNextItemWidth(ImGui::GetFontSize() * 7); - FString CategoryPreview; - if (Config->SelectedCategories.Num() == 0) - { - CategoryPreview = "None"; - } - else if (Config->SelectedCategories.Num() == 1) - { - CategoryPreview = *Config->SelectedCategories.CreateIterator(); - } - else - { - CategoryPreview = "Multiple"; - } - - const auto CategoryPreviewStr = StringCast(*CategoryPreview); - if (ImGui::BeginCombo("##Categories", CategoryPreviewStr.Get())) + if (ImGui::BeginMenu("Filters")) { for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories) { @@ -252,7 +240,7 @@ void FCogEngineWindow_Cheats::RenderContent() } } } - ImGui::EndCombo(); + ImGui::EndMenu(); } FCogWindowWidgets::SearchBar(Filter);