mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 09:56:59 +00:00
Fixed a bug calling "palette_editor" with invalid color (index out of range).
This commit is contained in:
parent
40c73cf11f
commit
489927528d
@ -411,32 +411,36 @@ bool ColorBar::msg_proc(JMessage msg)
|
||||
}
|
||||
/* pick the color */
|
||||
else if (m_hot != HOTCOLOR_NONE) {
|
||||
switch (m_hot) {
|
||||
color_t color = getHotColor(m_hot);
|
||||
|
||||
case HOTCOLOR_FGCOLOR:
|
||||
case HOTCOLOR_BGCOLOR: {
|
||||
Command* paledit_cmd = CommandsModule::instance()->get_command_by_name(CommandId::palette_editor);
|
||||
Params params;
|
||||
params.set("target", (m_hot == HOTCOLOR_FGCOLOR ? "foreground": "background"));
|
||||
params.set("open", "true");
|
||||
// Check if the color is invalid (e.g. index out of range)
|
||||
if (color_is_valid(color)) {
|
||||
|
||||
UIContext::instance()->execute_command(paledit_cmd, ¶ms);
|
||||
break;
|
||||
}
|
||||
switch (m_hot) {
|
||||
|
||||
default:
|
||||
color_t color = getHotColor(m_hot);
|
||||
case HOTCOLOR_FGCOLOR:
|
||||
case HOTCOLOR_BGCOLOR: {
|
||||
Command* paledit_cmd = CommandsModule::instance()->get_command_by_name(CommandId::palette_editor);
|
||||
Params params;
|
||||
params.set("target", (m_hot == HOTCOLOR_FGCOLOR ? "foreground": "background"));
|
||||
params.set("open", "true");
|
||||
|
||||
UIContext::instance()->execute_command(paledit_cmd, ¶ms);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
color_t color = getHotColor(m_hot);
|
||||
|
||||
// Check if the color is invalid (e.g. index out of range)
|
||||
if (color_is_valid(color)) {
|
||||
if (msg->mouse.left) {
|
||||
this->setFgColor(color);
|
||||
}
|
||||
if (msg->mouse.right) {
|
||||
this->setBgColor(color);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user