From bd0fa4cc4f9351ad12b0e89b04f346f31fc7a1e1 Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Tue, 25 Sep 2018 18:23:02 +0300 Subject: [PATCH] Fix 'index out of range' panic when adding a filter URL that has empty line in contents --- control.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control.go b/control.go index 45b339af..340f8479 100644 --- a/control.go +++ b/control.go @@ -1148,7 +1148,7 @@ func (filter *filter) update(now time.Time) (bool, error) { d := dnsfilter.New() for _, line := range lines { line = strings.TrimSpace(line) - if line[0] == '!' { + if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { log.Printf("Setting filter title to %s\n", m[0][1]) filter.Name = m[0][1]