Browse Source

Merge pull request #1019 from external-secrets/fix/assert-store-is-usable

Checking if condition is not nil before using it.
paul-the-alien[bot] 4 years ago
parent
commit
2860c3878a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      pkg/controllers/externalsecret/externalsecret_controller.go

+ 2 - 1
pkg/controllers/externalsecret/externalsecret_controller.go

@@ -483,7 +483,8 @@ func isSecretValid(existingSecret v1.Secret) bool {
 
 // assertStoreIsUsable assert that the store is ready to use.
 func assertStoreIsUsable(store esv1beta1.GenericStore) error {
-	if secretstore.GetSecretStoreCondition(store.GetStatus(), esv1beta1.SecretStoreReady).Status != v1.ConditionTrue {
+	condition := secretstore.GetSecretStoreCondition(store.GetStatus(), esv1beta1.SecretStoreReady)
+	if condition == nil || condition.Status != v1.ConditionTrue {
 		return fmt.Errorf(errSecretStoreNotReady, store.GetName())
 	}
 	return nil