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

This commit is contained in:
Janne Hellsten 2025-02-12 23:31:05 +02:00 committed by GitHub
parent 5086aad0b2
commit 539e96cc1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)