From d8644af0a695074a1004b687fadcea72f1abd166 Mon Sep 17 00:00:00 2001 From: ageekymonk Date: Tue, 3 Oct 2017 08:38:27 +1100 Subject: [PATCH] Checking the length of the field before trying to access the content as this is causing a crash when the first character is # without any subsequent characters --- goorgeous.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goorgeous.go b/goorgeous.go index f1b2671..21acfe2 100644 --- a/goorgeous.go +++ b/goorgeous.go @@ -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) {