From 852bfd2238b02edae190dddc1693d0933160df89 Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Wed, 17 Aug 2022 16:57:38 -0400 Subject: [PATCH] Fix a panic when reading annotations if the bundle is not there If the bundle is not present, the current bundleLoader will panic when it gets to addChannelsFromAnnotationsFile. If the bundle is nil, addChannelsFromAnnotationsFile should not attempt to do anything so instead it just returns now. Signed-off-by: Brad P. Crochet --- pkg/manifests/bundleloader.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/manifests/bundleloader.go b/pkg/manifests/bundleloader.go index 5d5bf2dc1..94f14a22a 100644 --- a/pkg/manifests/bundleloader.go +++ b/pkg/manifests/bundleloader.go @@ -51,6 +51,10 @@ func (b *bundleLoader) LoadBundle() error { // Add values from the annotations when the values are not loaded func (b *bundleLoader) addChannelsFromAnnotationsFile() { + if b.bundle == nil { + // None of this is relevant if the bundle was not found + return + } // Note that they will not get load for Bundle Format directories // and PackageManifest should not have the annotationsFile. However, // the following check to ensure that channels and default channels