diff options
| author | chmnchiang <chmnchiang@gmail.com> | 2022-08-01 09:13:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-01 18:13:06 +0200 |
| commit | 75a5e5065376d9103fc4bafc3ae6327304cee6e9 (patch) | |
| tree | 7ddef316b2d408702281234387d5f58cb74c0aa0 | |
| parent | 2e05e63cdfc3532b52a035ed13192560af45315d (diff) | |
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
| -rw-r--r-- | lua/telescope/config/resolve.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lua/telescope/config/resolve.lua b/lua/telescope/config/resolve.lua index ad8936e..9b951d3 100644 --- a/lua/telescope/config/resolve.lua +++ b/lua/telescope/config/resolve.lua @@ -139,7 +139,7 @@ end] = function(_, val) end _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] = function(selector, val) return function(...) @@ -149,7 +149,7 @@ end] = end _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] = function(selector, val) return function(...) |
