mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:15:53 +08:00
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
@ -4552,12 +4552,19 @@ std::string validate(const FullPrintConfig &cfg)
|
|||||||
}
|
}
|
||||||
case coFloats:
|
case coFloats:
|
||||||
case coPercents:
|
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) {
|
if (v < optdef->min || v > optdef->max) {
|
||||||
out_of_range = true;
|
out_of_range = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case coInt:
|
case coInt:
|
||||||
{
|
{
|
||||||
auto *iopt = static_cast<const ConfigOptionInt*>(opt);
|
auto *iopt = static_cast<const ConfigOptionInt*>(opt);
|
||||||
@ -4565,12 +4572,19 @@ std::string validate(const FullPrintConfig &cfg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case coInts:
|
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) {
|
if (v < optdef->min || v > optdef->max) {
|
||||||
out_of_range = true;
|
out_of_range = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
if (out_of_range)
|
if (out_of_range)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user