lib/ignore: Don't crash on empty patterns (fixes #6300) (#6301)

Instead of panicking when we try to look closer at the empty pattern,
return something like `invalid pattern "(?d)" in ignore file: missing
pattern`.
This commit is contained in:
Jakob Borg
2020-01-30 09:58:44 +01:00
committed by GitHub
parent ac3879e2b0
commit e0d4cdc9a3
2 changed files with 22 additions and 0 deletions
+4
View File
@@ -422,6 +422,10 @@ func parseLine(line string) ([]Pattern, error) {
}
}
if line == "" {
return nil, errors.New("missing pattern")
}
if pattern.result.IsCaseFolded() {
line = strings.ToLower(line)
}