Skip to content

Commit

Permalink
Merge pull request #91 from caenrique/fix-nil-env-table
Browse files Browse the repository at this point in the history
fix(env): early return causing nil env table error
  • Loading branch information
gorillamoe authored Aug 1, 2024
2 parents b10b937 + cb828db commit d353427
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/kulala/parser/env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ M.get_env = function()
elseif dotenv then
local dotenv_env = vim.fn.readfile(dotenv)
for _, line in ipairs(dotenv_env) do
if line:match("^%s*$") or line:match("^%s*#") then
return
end
local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$")
if key and value then
env[key] = value
-- if the line is not empy and not a comment, then
if not line:match("^%s*$") and not line:match("^%s*#") then
local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$")
if key and value then
env[key] = value
end
end
end
end
Expand Down

0 comments on commit d353427

Please sign in to comment.