Fix 'index out of range' panic when adding a filter URL that has empty line in contents
This commit is contained in:
parent
b0549a8e5b
commit
bd0fa4cc4f
|
@ -1148,7 +1148,7 @@ func (filter *filter) update(now time.Time) (bool, error) {
|
||||||
d := dnsfilter.New()
|
d := dnsfilter.New()
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
line = strings.TrimSpace(line)
|
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 {
|
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])
|
log.Printf("Setting filter title to %s\n", m[0][1])
|
||||||
filter.Name = m[0][1]
|
filter.Name = m[0][1]
|
||||||
|
|
Loading…
Reference in New Issue