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:51:27 +0100 |
commit | ec9942925c80a278a565091a194485999d6be74d (patch) | |
tree | 939536aa5c58c11baa1adbe2ece9938d3048e046 | |
parent | b6c1ac3bb0bbb3a4485feffda48e2c30b3d49386 (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>
-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 |