diff --git a/data/generated.go b/data/generated.go index 2eea4d2..37680fa 100644 --- a/data/generated.go +++ b/data/generated.go @@ -209,6 +209,9 @@ func isCompiledCoffeeScript(path, ext string, content []byte) bool { firstLine := getFirstLine(content) lastLines := getLines(content, -2) + if len(lastLines) < 2 { + return false + } if string(firstLine) == "(function() {" && string(lastLines[1]) == "}).call(this);" && @@ -675,9 +678,11 @@ func isGeneratedHTML(_, ext string, content []byte) bool { lines := getLines(content, 30) // Pkgdown - for _, l := range lines[:2] { - if bytes.Contains(l, []byte("")) { - return true + if len(lines) >= 2 { + for _, l := range lines[:2] { + if bytes.Contains(l, []byte("")) { + return true + } } }