OpenToonz - An open-source full-featured 2D animation creation software
C
fix input field crash (#2223)
shun-iwasawab932c159c4ab
diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cppindex 660961981..4cde0ece4 100644--- a/toonz/sources/common/tunit/tunit.cpp+++ b/toonz/sources/common/tunit/tunit.cpp@@ -482,7 +482,16 @@ bool TMeasuredValue::setValue(std::wstring s, int *pErr) {}}if (i > j) {- value = std::stod(s.substr(j, i - j));+ try {+ value = std::stod(s.substr(j, i - j));+ }+ // handle exceptions+ catch (const std::invalid_argument &e) {+ return false;+ } catch (const std::out_of_range &e) {+ return false;+ }+valueFlag = true;// skip blanksi = s.find_first_not_of(::to_wstring(" \t"), i);