From 7f5451f27a1da1f6e1d531a53048b0f562adb80c Mon Sep 17 00:00:00 2001 From: killianmuldoon Date: Fri, 10 Sep 2021 14:30:24 +0100 Subject: [PATCH] Fix panic in clusterctl describe from nil reference --- controllers/external/util.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/external/util.go b/controllers/external/util.go index 3e45a2034701..4c610d182559 100644 --- a/controllers/external/util.go +++ b/controllers/external/util.go @@ -39,6 +39,9 @@ const ( // Get uses the client and reference to get an external, unstructured object. func Get(ctx context.Context, c client.Client, ref *corev1.ObjectReference, namespace string) (*unstructured.Unstructured, error) { + if ref == nil { + return nil, errors.Errorf("cannot get object - object reference not set") + } obj := new(unstructured.Unstructured) obj.SetAPIVersion(ref.APIVersion) obj.SetKind(ref.Kind)