Commit 4c587f25 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

getInferredValuesList() in MINMAX mode : protection against 0 step

Showing with 12 additions and 6 deletions
+12 -6
......@@ -119,13 +119,19 @@ export class ParamValues implements IterableValues {
return this.valueList;
}
if (this.valueMode === ParamValueMode.MINMAX) {
const values = [ this.min ];
let latestVal = this.min + this.step;
while (latestVal <= this.max) {
values.push(latestVal);
latestVal += this.step;
// protection against infinite loops
if (this.step !== undefined && this.step > 0) {
// generate list
const values = [ this.min ];
let latestVal = this.min + this.step;
while (latestVal <= this.max) {
values.push(latestVal);
latestVal += this.step;
}
return values;
} else {
return [];
}
return values;
}
throw new Error("ParamValues.getInferredValuesList() : incorrect value mode" + ParamValueMode[this.valueMode]);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment