FIX: check int value invalid in Choise Field

Change-Id: I75cbe55b36dd75480903b6991f234c02ad8de5cc
This commit is contained in:
chunmao.guo 2022-09-14 19:13:27 +08:00 committed by Lane.Wei
parent 09e1c0a1af
commit 62da568e0b
1 changed files with 13 additions and 3 deletions

View File

@ -224,9 +224,19 @@ static wxString na_value() { return _(L("N/A")); }
void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true*/)
{
switch (m_opt.type) {
case coInt:
m_value = wxAtoi(str);
break;
case coInt: {
long val = 0;
if (!str.ToLong(&val)) {
if (!check_value) {
m_value.clear();
break;
}
show_error(m_parent, _(L("Invalid numeric.")));
set_value(int(val), true);
}
m_value = int(val);
break;
}
case coPercent:
case coPercents:
case coFloats: