From 935725b27bfebc9beed70d9059751a095e2dcc5b Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Wed, 9 Dec 2020 15:00:52 +0100
Subject: [PATCH] Fixed debug assert, when add ColorChange on DoubleSlider
 (vase mode specific issue)

---
 src/slic3r/GUI/DoubleSlider.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp
index bdfb8b08a..a90712cd0 100644
--- a/src/slic3r/GUI/DoubleSlider.cpp
+++ b/src/slic3r/GUI/DoubleSlider.cpp
@@ -754,6 +754,11 @@ void Control::draw_ticks(wxDC& dc)
     get_size(&width, &height);
     const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width;
     for (auto tick : m_ticks.ticks) {
+        if (tick.tick >= m_values.size()) {
+            // The case when OnPaint is called before m_ticks.ticks data are updated (specific for the vase mode)
+            break;
+        }
+
         const wxCoord pos = get_position_from_value(tick.tick);
         draw_ticks_pair(dc, pos, mid, 7);