diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-01-24 13:51:23 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2017-01-24 13:52:12 +0100 |
commit | 7cd9ecff001fa0a76d6df611db02bbcaf66a1024 (patch) | |
tree | 1d87d1ab67694335c4a72c66429b5988e5d7aed3 /modules | |
parent | 33a917f9c444fc6efb4a60de64d6fbe0e32f6d77 (diff) |
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 <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-base/luasrc/cbi/datatypes.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index 2039a3516..98f6a44d7 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 |