fix(resolve): Check val not nil in resolve funcs (#2097)
We did not check `val ~= nil` in the resolve functions, so config like
`{ nil, max = 30 }` will throw a nil error. Also, if the config is `{
padding = _ }`, the logic relies on the function handling the padding is
iterated before the one handling min/max in the map, which is not always
guaranteed.
Fix the bug by adding nil check in the function handling min/max. Close
This commit is contained in:
@@ -139,7 +139,7 @@ end] = function(_, val)
|
|||||||
end
|
end
|
||||||
|
|
||||||
_resolve_map[function(val)
|
_resolve_map[function(val)
|
||||||
return type(val) == "table" and val[1] >= 0 and val[1] < 1 and val["max"] ~= nil
|
return type(val) == "table" and val["max"] ~= nil and val[1] ~= nil and val[1] >= 0 and val[1] < 1
|
||||||
end] =
|
end] =
|
||||||
function(selector, val)
|
function(selector, val)
|
||||||
return function(...)
|
return function(...)
|
||||||
@@ -149,7 +149,7 @@ end] =
|
|||||||
end
|
end
|
||||||
|
|
||||||
_resolve_map[function(val)
|
_resolve_map[function(val)
|
||||||
return type(val) == "table" and val[1] >= 0 and val[1] < 1 and val["min"] ~= nil
|
return type(val) == "table" and val["min"] ~= nil and val[1] ~= nil and val[1] >= 0 and val[1] < 1
|
||||||
end] =
|
end] =
|
||||||
function(selector, val)
|
function(selector, val)
|
||||||
return function(...)
|
return function(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user