Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cmd: fix crash if rclone is invoked without any arguments - Fixes #8378

Janne Hellsten539e96cc1fc2
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 7e569c80b..545da371d 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -430,7 +430,7 @@ func initConfig() {
}
// Start the metrics server if configured and not running the "rc" command
- if os.Args[1] != "rc" {
+ if len(os.Args) >= 2 && os.Args[1] != "rc" {
_, err = rcserver.MetricsStart(ctx, &rc.Opt)
if err != nil {
fs.Fatalf(nil, "Failed to start metrics server: %v", err)