Skip to content

Commit 37e2a5b

Browse files
chore: also count empty string as nil (#210)
1 parent 703f29e commit 37e2a5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/guard/lint.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ end
156156
---@param nr any?
157157
---@param off number
158158
local function normalize(nr, off)
159-
return tonumber(nr or off) - off
159+
if not nr or nr == '' then
160+
return 0
161+
else
162+
return tonumber(nr) - off
163+
end
160164
end
161165

162166
local function json_get_offset(mes, attr, off)

0 commit comments

Comments
 (0)