some fix for coPercent cast & m_machine_limits_description_line null check

This commit is contained in:
remi durand 2021-01-04 16:29:03 +01:00
parent 996a42f2f9
commit 2f1a754f70
2 changed files with 4 additions and 8 deletions

View File

@ -5664,20 +5664,15 @@ std::string FullPrintConfig::validate()
bool out_of_range = false;
switch (opt->type()) {
case coFloat:
case coPercent:
{
auto *fopt = static_cast<const ConfigOptionFloat*>(opt);
out_of_range = fopt->value < optdef->min || fopt->value > optdef->max;
break;
}
case coPercent:
{
auto* fopt = static_cast<const ConfigOptionPercent*>(opt);
out_of_range = fopt->get_abs_value(100) < optdef->min || fopt->get_abs_value(100) > optdef->max;
break;
}
case coFloatOrPercent:
{
auto *fopt = static_cast<const ConfigOptionPercent*>(opt);
auto *fopt = static_cast<const ConfigOptionFloatOrPercent*>(opt);
out_of_range = fopt->get_abs_value(1) < optdef->min || fopt->get_abs_value(1) > optdef->max;
break;
}

View File

@ -3794,7 +3794,8 @@ void TabPrinter::update_machine_limits_description(const MachineLimitsUsage usag
break;
default: assert(false);
}
m_machine_limits_description_line->SetText(text);
if(m_machine_limits_description_line)
m_machine_limits_description_line->SetText(text);
//update fields used
//no need to worry for "silent" version, as it's only for marlin.