Skip to content

Commit

Permalink
Checking the length of the field before trying to access the content …
Browse files Browse the repository at this point in the history
…as this is

causing a crash when the first character is # without any subsequent characters
  • Loading branch information
ageekymonk committed Oct 2, 2017
1 parent 098da33 commit d8644af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion goorgeous.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func IsKeyword(data []byte) bool {

// ~~ Comments
func isComment(data []byte) bool {
return charMatches(data[0], '#') && charMatches(data[1], ' ')
return len(data) > 1 && charMatches(data[0], '#') && charMatches(data[1], ' ')
}

func (p *parser) generateComment(out *bytes.Buffer, data []byte) {
Expand Down

0 comments on commit d8644af

Please sign in to comment.