check for empty content in getHeaderAndFooter function

Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
This commit is contained in:
Manuel Carmona 2017-11-08 13:20:52 +01:00
parent 8ddce8bc4b
commit 5dad184af0

View File

@ -158,6 +158,11 @@ var modelinesFunc = []Strategy{
func getHeaderAndFooter(content []byte) []byte {
const searchScope = 5
if len(content) == 0 {
return content
}
if bytes.Count(content, []byte("\n")) < 2*searchScope {
return content
}