Skip to content

Commit e02cc46

Browse files
committed
Null check
1 parent 0780bf6 commit e02cc46

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lua/spectre/state_utils.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ end
5858

5959
local get_options = function(cfg)
6060
local options_value = {}
61-
for key, value in pairs(state.options) do
62-
if value and cfg.options[key] ~= nil then
63-
table.insert(options_value, cfg.options[key].value)
61+
-- Check if cfg.options exists before trying to iterate through it
62+
if cfg.options then
63+
for key, value in pairs(state.options) do
64+
if value and cfg.options[key] ~= nil then
65+
table.insert(options_value, cfg.options[key].value)
66+
end
6467
end
6568
end
6669
return options_value

0 commit comments

Comments
 (0)