mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix crash clicking in the PaletteView area with an empty tileset
This commit is contained in:
parent
f416d0c356
commit
3e55928d41
@ -620,13 +620,15 @@ bool PaletteView::onProcessMessage(Message* msg)
|
||||
if (m_state == State::SELECTING_COLOR &&
|
||||
m_hot.part == Hit::COLOR) {
|
||||
int idx = m_hot.color;
|
||||
idx = base::clamp(idx, 0, m_adapter->size()-1);
|
||||
idx = base::clamp(idx, 0, std::max(0, m_adapter->size()-1));
|
||||
|
||||
const MouseButton button = mouseMsg->button();
|
||||
|
||||
if (hasCapture() && ((idx != m_currentEntry) ||
|
||||
(msg->type() == kMouseDownMessage) ||
|
||||
(button == kButtonMiddle))) {
|
||||
if (hasCapture() &&
|
||||
(idx >= 0 && idx < m_adapter->size()) &&
|
||||
((idx != m_currentEntry) ||
|
||||
(msg->type() == kMouseDownMessage) ||
|
||||
(button == kButtonMiddle))) {
|
||||
if (button != kButtonMiddle) {
|
||||
if (!msg->ctrlPressed() && !msg->shiftPressed())
|
||||
deselect();
|
||||
|
Loading…
Reference in New Issue
Block a user