[aseprite] 237/308: Fix crash when ContextBar::InkShadesField is clicked and it's empty

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit e2e5fbf3f1794e2339b416cb7f9bc9a8f644dcb3
Author: David Capello <davidcapello at gmail.com>
Date:   Mon Feb 15 17:07:34 2016 -0300

    Fix crash when ContextBar::InkShadesField is clicked and it's empty
---
 src/app/ui/context_bar.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp
index feb93e6..79ec06a 100644
--- a/src/app/ui/context_bar.cpp
+++ b/src/app/ui/context_bar.cpp
@@ -1,5 +1,5 @@
 // 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
 // it under the terms of the GNU General Public License version 2 as
@@ -477,7 +477,8 @@ class ContextBar::InkShadesField : public HBox {
 
         case kMouseDownMessage: {
           if (m_click == DragAndDrop) {
-            if (m_hotIndex >= 0) {
+            if (m_hotIndex >= 0 &&
+                m_hotIndex < int(m_shade.size())) {
               m_dragIndex = m_hotIndex;
               m_dropBefore = false;
               captureMouse();
@@ -494,6 +495,8 @@ class ContextBar::InkShadesField : public HBox {
           }
 
           if (m_dragIndex >= 0) {
+            ASSERT(m_dragIndex < int(m_shade.size()));
+
             auto color = m_shade[m_dragIndex];
             m_shade.erase(m_shade.begin()+m_dragIndex);
             if (m_hotIndex >= 0)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list