From 18877dc908bcb201389df87836a29bc2fcb1e08d Mon Sep 17 00:00:00 2001 From: supermerill Date: Tue, 25 Apr 2023 22:34:55 +0200 Subject: [PATCH] crash fix: double slider can have strange array size... FIXME: investigate further. m_layers_values. size can be == 3 + m_values, and get_layer_number return m_values.size() (with wipe tower) is it normal? --- src/slic3r/GUI/DoubleSlider.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index f27f69375d0..9018765cd81 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -783,9 +783,10 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer return str; if (label_type == ltHeightWithLayer) { size_t layer_number = m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1); + layer_number = std::min(m_values.size() - 1, layer_number); double layer_height = m_values.empty() ? m_label_koef : m_values[layer_number - 1] - (layer_number > 1 ? m_values[layer_number - 2] : 0); return format_wxstr("%1%\n(%2%,\n%3%)", str, wxString::Format("%.*f", 2, layer_height), layer_number); - } + } } return wxEmptyString;