From f29bcfb10899d5a32230b2a3dd6a4b4b458750a6 Mon Sep 17 00:00:00 2001 From: Sjors Holtrop Date: Tue, 14 Jan 2025 14:45:34 +0100 Subject: [PATCH] handle len(args) < 1 case Signed-off-by: Sjors Holtrop --- cmd/flux/resume.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/flux/resume.go b/cmd/flux/resume.go index 92f9184d41..6a622dcb7b 100644 --- a/cmd/flux/resume.go +++ b/cmd/flux/resume.go @@ -175,7 +175,11 @@ func (resume resumeCommand) patch(ctx context.Context, args []string, listOpts [ } if resume.list.len() == 0 { - logger.Failuref("%s object '%s' not found in %s namespace", resume.kind, args[0], resume.namespace) + if len(args) < 1 { + logger.Failuref("no %s objects found in %s namespace", resume.kind, resume.namespace) + } else { + logger.Failuref("%s object '%s' not found in %s namespace", resume.kind, args[0], resume.namespace) + } return nil, nil }