From 75d8e7bb8957f8a7dac76f405ea6565a87413dfa Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 19 Jan 2025 17:56:21 -0600 Subject: [PATCH] [nostalgia/core/studio/paletteeditor] Fix crash that occurs when removing last color --- .../core/src/studio/paletteeditor/paletteeditor-imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index 1ae4f7bf..d6bc4a36 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -107,7 +107,7 @@ void PaletteEditorImGui::colorInput(ox::CStringView label, int &v, bool &inputFo void PaletteEditorImGui::drawColorsEditor() noexcept { constexpr auto tableFlags = ImGuiTableFlags_RowBg; auto const colorsSz = ImGui::GetContentRegionAvail(); - auto const colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page); + auto colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page); auto const colorEditorWidth = 220; static constexpr auto toolbarHeight = 40; { @@ -123,6 +123,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { if (ImGui::Button("Remove", sz)) { std::ignore = pushCommand(m_pal, m_selectedColorRow); m_selectedColorRow = ox::min(colorCnt(m_pal, m_page) - 1, m_selectedColorRow); + colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page); } ImGui::SameLine(); ImGui::BeginDisabled(m_selectedColorRow <= 0);