Skip to content

Commit

Permalink
add boundary checking
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Dec 9, 2024
1 parent bdbf1fa commit 51c49b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func (p *parser) newLineCharacterNum(src string) int {
for i := 0; i < len(src); i++ {
switch src[i] {
case '\r':
if src[i+1] == '\n' {
if len(src) > i+1 && src[i+1] == '\n' {
i++
}
num++
Expand Down

0 comments on commit 51c49b3

Please sign in to comment.