Skip to content

Commit 770e653

Browse files
authored
fix encountering empty line in source (last line?`) (#63)
1 parent 38a318b commit 770e653

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/LineNumbers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function SourceFile(data::AbstractString)
1717
line = readuntil(buf,'\n')
1818
!eof(buf) && push!(offsets, position(buf))
1919
end
20-
if !isempty(offsets) && line[end] == '\n'
20+
if !isempty(offsets) && !isempty(line) && line[end] == '\n'
2121
push!(offsets, position(buf))
2222
end
2323
SourceFile(copy(codeunits(data)), offsets)

0 commit comments

Comments
 (0)