Skip to content
Snippets Groups Projects
Commit a6a6635b authored by Alvaro Cabrera Durán's avatar Alvaro Cabrera Durán
Browse files

Avoid negative values for array.length; fix #477

parent 4c56762b
No related branches found
No related tags found
No related merge requests found
......@@ -82,8 +82,8 @@ function arrayType(value, path, resolve, traverseCallback) {
if (optionalsProbability !== false) {
length = fixedProbabilities
? Math.round(maxItems * optionalsProbability)
: random.number(minItems, maxItems) * optionalsProbability;
? Math.round((maxItems || length) * optionalsProbability)
: Math.abs(random.number(minItems, maxItems) * optionalsProbability);
}
// TODO below looks bad. Should additionalItems be copied as-is?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment