Skip to content

Commit

Permalink
Fix nil pointer in parentRef namespace dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-cattermole committed Nov 23, 2023
1 parent 83228b0 commit 8ec8fd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/common/gatewayapi_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func GetKuadrantNamespaceFromPolicyTargetRef(ctx context.Context, cli client.Cli
}
// First should be OK considering there's 1 Kuadrant instance per cluster and all are tagged
parentRef := route.Spec.ParentRefs[0]
gwNamespacedName = types.NamespacedName{Namespace: string(*parentRef.Namespace), Name: string(parentRef.Name)}
gwNamespacedName = types.NamespacedName{Namespace: string(ptr.Deref(parentRef.Namespace, gatewayapiv1.Namespace(route.Namespace))), Name: string(parentRef.Name)}

Check warning on line 221 in pkg/common/gatewayapi_utils.go

View check run for this annotation

Codecov / codecov/patch

pkg/common/gatewayapi_utils.go#L221

Added line #L221 was not covered by tests
}
gw := &gatewayapiv1.Gateway{}
if err := cli.Get(ctx, gwNamespacedName, gw); err != nil {
Expand Down

0 comments on commit 8ec8fd6

Please sign in to comment.