mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix a bug trying to select a color index < 0 when there is no color selected in the palette view.
This commit is contained in:
parent
b30d28e920
commit
ade6b0d333
@ -70,6 +70,8 @@ Color Color::fromGray(int g)
|
||||
// static
|
||||
Color Color::fromIndex(int index)
|
||||
{
|
||||
assert(index >= 0 && index < Palette::MaxColors);
|
||||
|
||||
Color color(Color::IndexType);
|
||||
color.m_value.index = index;
|
||||
return color;
|
||||
|
@ -836,7 +836,9 @@ void PaletteEntryEditor::onPalChange()
|
||||
{
|
||||
if (!m_selfPalChange) {
|
||||
PaletteView* palette_editor = app_get_colorbar()->getPaletteView();
|
||||
setColor(Color::fromIndex(palette_editor->getSelectedEntry()));
|
||||
int index = palette_editor->getSelectedEntry();
|
||||
if (index >= 0)
|
||||
setColor(Color::fromIndex(index));
|
||||
|
||||
// Redraw the window
|
||||
invalidate();
|
||||
|
Loading…
Reference in New Issue
Block a user