Fix for #6921 - Error while disabling filament overrides in Dutch language

This commit is contained in:
YuSanka 2021-09-08 15:30:51 +02:00
parent beee18f229
commit a115da6334

View File

@ -230,18 +230,21 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
} }
double val; double val;
bool is_na_value = m_opt.nullable && str == na_value();
const char dec_sep = is_decimal_separator_point() ? '.' : ','; const char dec_sep = is_decimal_separator_point() ? '.' : ',';
const char dec_sep_alt = dec_sep == '.' ? ',' : '.'; const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
// Replace the first incorrect separator in decimal number. // Replace the first incorrect separator in decimal number,
if (str.Replace(dec_sep_alt, dec_sep, false) != 0) // if this value doesn't "N/A" value in some language
// see https://github.com/prusa3d/PrusaSlicer/issues/6921
if (!is_na_value && str.Replace(dec_sep_alt, dec_sep, false) != 0)
set_value(str, false); set_value(str, false);
if (str == dec_sep) if (str == dec_sep)
val = 0.0; val = 0.0;
else else
{ {
if (m_opt.nullable && str == na_value()) if (is_na_value)
val = ConfigOptionFloatsNullable::nil_value(); val = ConfigOptionFloatsNullable::nil_value();
else if (!str.ToDouble(&val)) else if (!str.ToDouble(&val))
{ {