Skip to content

Commit 4c0e00c

Browse files
authored
handled nil pointer in imagePullSecret service when asserting k8s error type (#3208) (#106)
1 parent 77958d0 commit 4c0e00c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/dockerRegistry/DockerRegistryIpsConfigService.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ func (impl DockerRegistryIpsConfigServiceImpl) createOrUpdateDockerRegistryImage
234234
}
235235
secret, err := impl.k8sUtil.GetSecret(namespace, ipsName, k8sClient)
236236
if err != nil {
237-
statusError, _ := err.(*k8sErrors.StatusError)
238-
if statusError.Status().Code != http.StatusNotFound {
237+
statusError, ok := err.(*k8sErrors.StatusError)
238+
if !ok || (statusError != nil && statusError.Status().Code != http.StatusNotFound) {
239239
impl.logger.Errorw("error in getting secret", "clusterId", clusterId, "namespace", namespace, "ipsName", ipsName, "error", err)
240240
return err
241241
}

0 commit comments

Comments
 (0)