From: Jo-Philipp Wich Date: Sun, 13 Mar 2011 21:56:31 +0000 (+0000) Subject: libs/web: explicitely cast input value of %m pattern to float in order to avoid throw... X-Git-Tag: 0.11.0~2202 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8cab9e2b8fcb6116d49b116bbb747069551d094c;p=oweals%2Fluci.git libs/web: explicitely cast input value of %m pattern to float in order to avoid throwing an exception in toFixed() with very low values --- diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index 41e751206..ddafd7918 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -1032,7 +1032,7 @@ if( ! String.format ) var pr = pPrecision ? Math.floor(10*parseFloat('0'+pPrecision)) : 2; var i = 0; - var val = (param || 0); + var val = parseFloat(param || 0); var units = [ '', 'K', 'M', 'G', 'T', 'P', 'E' ]; for (i = 0; (i < units.length) && (val > mf); i++)