Skip to content

Commit 9abbb8b

Browse files
authored
zoekt-indexserver: Prevent invalid config from causing an NPE (#612)
When the user specifies an invalid mirror config that contains an entry without any of the GithubUser / GithubOrg / ... repository definitions, zoekt-indexserver would crash, because `cmd` stays `nil` and causes a SIGSEGV when it is later accessed in `main.executeMirror`.
1 parent 25c1ea5 commit 9abbb8b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cmd/zoekt-indexserver/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ func executeMirror(cfg []ConfigEntry, repoDir string, pendingRepos chan<- string
260260
cmd.Args = append(cmd.Args, "-active")
261261
}
262262
cmd.Args = append(cmd.Args, c.GerritApiURL)
263+
} else {
264+
log.Printf("executeMirror: ignoring config, because it does not contain any valid repository definition: %q", c)
265+
continue
263266
}
264267

265268
stdout, _ := loggedRun(cmd)

0 commit comments

Comments
 (0)