From: vlakoff Date: Sat, 29 Oct 2016 08:10:26 +0000 (+0200) Subject: Void if precision value is not a number X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=11ee7f8afb99348f1db6d50aa65656e064107d13;p=clean-css.git Void if precision value is not a number --- diff --git a/lib/selectors/simple.js b/lib/selectors/simple.js index 5b8b3392..5e6fd3c1 100644 --- a/lib/selectors/simple.js +++ b/lib/selectors/simple.js @@ -86,7 +86,7 @@ function whitespaceMinifier(name, value) { } function precisionMinifier(_, value, precisionOptions) { - if (precisionOptions.value === -1 || value.indexOf('.') === -1) + if (precisionOptions.value === -1 || isNaN(precisionOptions.value) || value.indexOf('.') === -1) return value; return value @@ -394,6 +394,10 @@ function buildPrecision(options) { precision.value = options.roundingPrecision === undefined ? DEFAULT_ROUNDING_PRECISION : parseInt(options.roundingPrecision); + + if (isNaN(precision.value)) + return precision; + precision.multiplier = Math.pow(10, precision.value); precision.regexp = new RegExp('(\\d*\\.\\d{' + (precision.value + 1) + ',})px', 'g');