Fixed validation of cfg when a vector contains a nullable option which is nil for some elements but not for others #10163, SPE-1613
This commit is contained in:
parent
8e0b45fc83
commit
c654a6714a
1 changed files with 16 additions and 2 deletions
|
@ -4552,12 +4552,19 @@ std::string validate(const FullPrintConfig &cfg)
|
|||
}
|
||||
case coFloats:
|
||||
case coPercents:
|
||||
for (double v : static_cast<const ConfigOptionVector<double>*>(opt)->values)
|
||||
{
|
||||
const auto* vec = static_cast<const ConfigOptionVector<double>*>(opt);
|
||||
for (size_t i = 0; i < vec->size(); ++i) {
|
||||
if (vec->is_nil(i))
|
||||
continue;
|
||||
double v = vec->values[i];
|
||||
if (v < optdef->min || v > optdef->max) {
|
||||
out_of_range = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case coInt:
|
||||
{
|
||||
auto *iopt = static_cast<const ConfigOptionInt*>(opt);
|
||||
|
@ -4565,12 +4572,19 @@ std::string validate(const FullPrintConfig &cfg)
|
|||
break;
|
||||
}
|
||||
case coInts:
|
||||
for (int v : static_cast<const ConfigOptionVector<int>*>(opt)->values)
|
||||
{
|
||||
const auto* vec = static_cast<const ConfigOptionVector<int>*>(opt);
|
||||
for (size_t i = 0; i < vec->size(); ++i) {
|
||||
if (vec->is_nil(i))
|
||||
continue;
|
||||
int v = vec->values[i];
|
||||
if (v < optdef->min || v > optdef->max) {
|
||||
out_of_range = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:;
|
||||
}
|
||||
if (out_of_range)
|
||||
|
|
Loading…
Reference in a new issue