mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +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
|
// static
|
||||||
Color Color::fromIndex(int index)
|
Color Color::fromIndex(int index)
|
||||||
{
|
{
|
||||||
|
assert(index >= 0 && index < Palette::MaxColors);
|
||||||
|
|
||||||
Color color(Color::IndexType);
|
Color color(Color::IndexType);
|
||||||
color.m_value.index = index;
|
color.m_value.index = index;
|
||||||
return color;
|
return color;
|
||||||
|
@ -836,7 +836,9 @@ void PaletteEntryEditor::onPalChange()
|
|||||||
{
|
{
|
||||||
if (!m_selfPalChange) {
|
if (!m_selfPalChange) {
|
||||||
PaletteView* palette_editor = app_get_colorbar()->getPaletteView();
|
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
|
// Redraw the window
|
||||||
invalidate();
|
invalidate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user