From 39c2d1bc1a6de0800cb8ed11db692f97ff5f02c2 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Wed, 17 Mar 2021 15:51:14 +0100 Subject: [PATCH] cmd/syncthing: Check os.Args length (fixes #7486) --- cmd/syncthing/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index a8fbf0ace..0da11245b 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -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)