diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 359d9d97e4..c6f6babae1 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -322,6 +322,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true str.Replace(" ", wxEmptyString, true); if (!str.IsEmpty()) { bool invalid_val = false; + bool out_of_range_val = false; wxStringTokenizer thumbnails(str, ","); while (thumbnails.HasMoreTokens()) { wxString token = thumbnails.GetNextToken(); @@ -332,8 +333,12 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) { wxString y_str = thumbnail.GetNextToken(); if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) { - out_values.push_back(Vec2d(x, y)); - continue; + if (0 < x && x < 1000 && 0 < y && y < 1000) { + out_values.push_back(Vec2d(x, y)); + continue; + } + out_of_range_val = true; + break; } } } @@ -341,7 +346,15 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true break; } - if (invalid_val) { + if (out_of_range_val) { + wxString text_value; + if (!m_value.empty()) + text_value = get_thumbnails_string(boost::any_cast>(m_value)); + set_value(text_value, true); + show_error(m_parent, _L("Input value is out of range") + ); + } + else if (invalid_val) { wxString text_value; if (!m_value.empty()) text_value = get_thumbnails_string(boost::any_cast>(m_value));