about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMatt Snider <matt.snider@protonmail.com>2019-10-27 13:54:22 +0000
committerDrew DeVault <sir@cmpwn.com>2019-11-01 11:02:01 -0400
commitcd39e8f90cde6adb3d127454f99184d84d74d40c (patch)
tree832b874872121219e00108429ffb891f659db3c8
parent310bec27024579e7ada35585b3190ab875540804 (diff)
downloadaerc-cd39e8f90cde6adb3d127454f99184d84d74d40c.tar.gz
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.
-rw-r--r--worker/notmuch/worker.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 96adc29..be213bf 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -387,6 +387,10 @@ func (w *worker) loadQueryMap(acctConfig *config.AccountConfig) error {
 	scanner := bufio.NewScanner(f)
 	for scanner.Scan() {
 		line := scanner.Text()
+		if line == "" || line[0] == '#' {
+			continue
+		}
+
 		split := strings.SplitN(line, "=", 2)
 		if len(split) != 2 {
 			return fmt.Errorf("invalid line %q, want name=query", line)
' href='#n136'>136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159