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

View File

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