Skip to content

Commit

Permalink
crash fix: double slider can have strange array size...
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
supermerill committed Apr 25, 2023
1 parent 1a5b72e commit 18877dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/slic3r/GUI/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 18877dc

Please sign in to comment.