From f6668169435184a7b1ab2f5bfecc2ea2cc39f6f1 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 18 Apr 2024 00:40:31 +1000 Subject: [PATCH] ImGuiOverlays: Fix possible crash in save state selector --- src/core/imgui_overlays.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 0958835b5..c91873dee 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -1054,18 +1054,19 @@ void SaveStateSelectorUI::Draw() ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground); { ImGui::SetCursorPosX(padding); - ImGui::BeginTable("table", 2); + if (ImGui::BeginTable("table", 2)) + { + ImGui::TableNextColumn(); + ImGui::TextUnformatted(s_load_legend.c_str()); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(s_prev_legend.c_str()); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(s_save_legend.c_str()); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(s_next_legend.c_str()); - ImGui::TableNextColumn(); - ImGui::TextUnformatted(s_load_legend.c_str()); - ImGui::TableNextColumn(); - ImGui::TextUnformatted(s_prev_legend.c_str()); - ImGui::TableNextColumn(); - ImGui::TextUnformatted(s_save_legend.c_str()); - ImGui::TableNextColumn(); - ImGui::TextUnformatted(s_next_legend.c_str()); - - ImGui::EndTable(); + ImGui::EndTable(); + } } ImGui::EndChild(); }