diff options
author | YuSanka <yusanka@gmail.com> | 2019-03-07 12:56:17 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2019-03-07 12:56:17 +0300 |
commit | 8756a1455737d1cdc78bb477a7ec607d84e968a2 (patch) | |
tree | e172e1eab4409a7203bc7ae15d684a1195f69b7e /src/slic3r/GUI/Field.cpp | |
parent | aa0737fa5ef2cf3ecbaecd74c3ac80f1fb77aaaa (diff) |
Fixed crash on "stoi argument out of range" from SpinConrol (SPE-847)
Diffstat (limited to 'src/slic3r/GUI/Field.cpp')
-rw-r--r-- | src/slic3r/GUI/Field.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 0d65e0ef5..dc0550b3b 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -464,8 +464,14 @@ void SpinCtrl::BUILD() { // # As a workaround, we get the new value from $event->GetString and store // # here temporarily so that we can return it from $self->get_value std::string value = e.GetString().utf8_str().data(); - if (is_matched(value, "^\\-?\\d+$")) - tmp_value = std::stoi(value); + if (is_matched(value, "^\\-?\\d+$")) { + try { + tmp_value = std::stoi(value); + } + catch (const std::exception & /* e */) { + tmp_value = -9999; + } + } else tmp_value = -9999; #ifdef __WXOSX__ propagate_value(); |