mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 21:39:57 +00:00
Fix crash when ContextBar::InkShadesField is clicked and it's empty
This commit is contained in:
parent
5d4a568804
commit
e2e5fbf3f1
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -477,7 +477,8 @@ class ContextBar::InkShadesField : public HBox {
|
|||||||
|
|
||||||
case kMouseDownMessage: {
|
case kMouseDownMessage: {
|
||||||
if (m_click == DragAndDrop) {
|
if (m_click == DragAndDrop) {
|
||||||
if (m_hotIndex >= 0) {
|
if (m_hotIndex >= 0 &&
|
||||||
|
m_hotIndex < int(m_shade.size())) {
|
||||||
m_dragIndex = m_hotIndex;
|
m_dragIndex = m_hotIndex;
|
||||||
m_dropBefore = false;
|
m_dropBefore = false;
|
||||||
captureMouse();
|
captureMouse();
|
||||||
@ -494,6 +495,8 @@ class ContextBar::InkShadesField : public HBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_dragIndex >= 0) {
|
if (m_dragIndex >= 0) {
|
||||||
|
ASSERT(m_dragIndex < int(m_shade.size()));
|
||||||
|
|
||||||
auto color = m_shade[m_dragIndex];
|
auto color = m_shade[m_dragIndex];
|
||||||
m_shade.erase(m_shade.begin()+m_dragIndex);
|
m_shade.erase(m_shade.begin()+m_dragIndex);
|
||||||
if (m_hotIndex >= 0)
|
if (m_hotIndex >= 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user