Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: nil pointer for env (#4171)
ecmadao985520b3a418
diff --git a/server/api/v1/environment_service.go b/server/api/v1/environment_service.goindex 19851f027d..4c34dbf5fa 100644--- a/server/api/v1/environment_service.go+++ b/server/api/v1/environment_service.go@@ -90,6 +90,7 @@ func (s *EnvironmentService) CreateEnvironment(ctx context.Context, request *v1pResourceID: request.EnvironmentId,Title: request.Environment.Title,Order: request.Environment.Order,+ Protected: request.Environment.Tier == v1pb.EnvironmentTier_PROTECTED,},principalID,)diff --git a/store/environment.go b/store/environment.goindex 9b41deabaf..75b7b6ebc4 100644--- a/store/environment.go+++ b/store/environment.go@@ -226,6 +226,9 @@ func (s *Store) GetEnvironmentV2(ctx context.Context, find *FindEnvironmentMessaif err != nil {return nil, err}+ if environment == nil {+ return nil, nil+ }if err := tx.Commit(); err != nil {return nil, FormatError(err)diff --git a/store/instance.go b/store/instance.goindex 24217257bf..8f767ca27a 100644--- a/store/instance.go+++ b/store/instance.go@@ -857,6 +857,10 @@ func (s *Store) CreateInstanceV2(ctx context.Context, environmentID string, instif err != nil {return nil, err}+ if environment == nil {+ return nil, common.Errorf(common.NotFound, "environment %s not found", environmentID)+ }+var instanceID intif err := tx.QueryRowContext(ctx, `INSERT INTO instance (@@ -964,6 +968,9 @@ func (s *Store) UpdateInstanceV2(ctx context.Context, patch *UpdateInstanceMessaif err != nil {return nil, err}+ if environment == nil {+ return nil, common.Errorf(common.NotFound, "environment %s not found", patch.EnvironmentID)+ }args = append(args, patch.ResourceID, environment.UID)