notmuch: ignore comments and blank lines when processing query-map file
A segmentation fault occurs when using the notmuch backend and a `query-map` file that contains blank lines or comments.
This commit is contained in:
parent
310bec2702
commit
cd39e8f90c
1 changed files with 4 additions and 0 deletions
|
@ -387,6 +387,10 @@ func (w *worker) loadQueryMap(acctConfig *config.AccountConfig) error {
|
||||||
scanner := bufio.NewScanner(f)
|
scanner := bufio.NewScanner(f)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
|
if line == "" || line[0] == '#' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
split := strings.SplitN(line, "=", 2)
|
split := strings.SplitN(line, "=", 2)
|
||||||
if len(split) != 2 {
|
if len(split) != 2 {
|
||||||
return fmt.Errorf("invalid line %q, want name=query", line)
|
return fmt.Errorf("invalid line %q, want name=query", line)
|
||||||
|
|
Loading…
Reference in a new issue