fix: error when opts is nil in pickers.new (#1471)
This commit is contained in:
@@ -1214,14 +1214,16 @@ function Picker:_do_selection(prompt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
pickers.new = function(opts, defaults)
|
pickers.new = function(opts, defaults)
|
||||||
|
opts = opts or {}
|
||||||
|
defaults = defaults or {}
|
||||||
local result = {}
|
local result = {}
|
||||||
|
|
||||||
for k, v in pairs(opts or {}) do
|
for k, v in pairs(opts) do
|
||||||
assert(type(k) == "string", "Should be string, opts")
|
assert(type(k) == "string", "Should be string, opts")
|
||||||
result[k] = v
|
result[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(defaults or {}) do
|
for k, v in pairs(defaults) do
|
||||||
if result[k] == nil then
|
if result[k] == nil then
|
||||||
assert(type(k) == "string", "Should be string, defaults")
|
assert(type(k) == "string", "Should be string, defaults")
|
||||||
result[k] = v
|
result[k] = v
|
||||||
|
|||||||
Reference in New Issue
Block a user