[nostalgia/core/studio/paletteeditor] Fix crash that occurs when removing last color
This commit is contained in:
parent
6b53eaf6b1
commit
75d8e7bb89
@ -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<RemoveColorCommand>(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);
|
||||
|
Loading…
Reference in New Issue
Block a user