cmd/syncthing: Check os.Args length (fixes #7486)

This commit is contained in:
Simon Frei 2021-03-17 15:51:14 +01:00
parent cd21b8dfa5
commit 39c2d1bc1a
No known key found for this signature in database
GPG Key ID: 7C31D23ECB1006F3
1 changed files with 1 additions and 1 deletions

View File

@ -215,7 +215,7 @@ func main() {
// The "cli" subcommand uses a different command line parser, and e.g. help
// gets mangled when integrating it as a subcommand -> detect it here at the
// beginning.
if os.Args[1] == "cli" {
if len(os.Args) > 1 && os.Args[1] == "cli" {
if err := cli.Run(); err != nil {
fmt.Println(err)
os.Exit(1)