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>
This commit is contained in:
parent
33a917f9c4
commit
7cd9ecff00
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue