Skip to content

Commit 5ab977a

Browse files
njhaleecordell
authored andcommitted
fix(sub): prevent nil pointer access
Prevent a panic from a nil pointer access when checking the health of a CatalogSource for Subscription status updates.
1 parent 3f7675c commit 5ab977a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/controller/operators/catalog/subscription/reconciler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ func (c *catalogHealthReconciler) health(now *metav1.Time, catalog *v1alpha1.Cat
182182
// healthy returns true if the given catalog is healthy, false otherwise, and any error encountered
183183
// while checking the catalog's registry server.
184184
func (c *catalogHealthReconciler) healthy(catalog *v1alpha1.CatalogSource) (bool, error) {
185-
return c.registryReconcilerFactory.ReconcilerForSource(catalog).CheckRegistryServer(catalog)
185+
rec := c.registryReconcilerFactory.ReconcilerForSource(catalog)
186+
if rec == nil {
187+
return false, fmt.Errorf("could not get reconciler for catalog: %#v", catalog)
188+
}
189+
190+
return rec.CheckRegistryServer(catalog)
186191
}
187192

188193
// installPlanReconciler reconciles InstallPlan status for Subscriptions.

0 commit comments

Comments
 (0)