From a0dc949ce32871d558461ed00a2998a61ad73cfb Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Wed, 28 Feb 2024 16:22:34 -0500 Subject: [PATCH] Improve error handling for json path results --- .../pkg/registry/customresource/strategy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy.go index 822a2f8f55b..9a5da2ef238 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy.go @@ -363,7 +363,7 @@ func (a customResourceStrategy) selectableFields(obj runtime.Object, objectMeta } var value any - if len(results) > 0 && len(results[0]) == 1 { + if len(results) > 0 && len(results[0]) > 0 { if len(results) > 1 || len(results[0]) > 1 { return nil, fmt.Errorf("unexpectedly received more than one JSON path result") }