From: Jo-Philipp Wich Date: Tue, 24 Jan 2017 12:51:23 +0000 (+0100) Subject: luci-base: datatypes.lua: add missing parentheses in conditional X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7cd9ecff001fa0a76d6df611db02bbcaf66a1024;p=project%2Fluci.git luci-base: datatypes.lua: add missing parentheses in conditional The missing parens lead to a wrong expression precedence, causing a runtime error when attempting to compare nil with a number. Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index 2039a3516b..98f6a44d77 100644 --- a/modules/luci-base/luasrc/cbi/datatypes.lua +++ b/modules/luci-base/luasrc/cbi/datatypes.lua @@ -139,7 +139,7 @@ function ipmask4(val) local ip, mask = val:match("^([^/]+)/([^/]+)$") local bits = tonumber(mask) - if bits and bits < 0 or bits > 32 then + if bits and (bits < 0 or bits > 32) then return false end @@ -154,7 +154,7 @@ function ipmask6(val) local ip, mask = val:match("^([^/]+)/([^/]+)$") local bits = tonumber(mask) - if bits and bits < 0 or bits > 128 then + if bits and (bits < 0 or bits > 128) then return false end