Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit fc86c44

Browse files
authored
Fix potential panic (zalando#2289)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
1 parent 0e7beb5 commit fc86c44

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/controller/util.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ func (c *Controller) postgresTeamAdd(obj interface{}) {
415415
pgTeam, ok := obj.(*acidv1.PostgresTeam)
416416
if !ok {
417417
c.logger.Errorf("could not cast to PostgresTeam spec")
418+
return
418419
}
419420
c.logger.Debugf("PostgreTeam %q added. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name)
420421
c.loadPostgresTeams()
@@ -424,6 +425,7 @@ func (c *Controller) postgresTeamUpdate(prev, obj interface{}) {
424425
pgTeam, ok := obj.(*acidv1.PostgresTeam)
425426
if !ok {
426427
c.logger.Errorf("could not cast to PostgresTeam spec")
428+
return
427429
}
428430
c.logger.Debugf("PostgreTeam %q updated. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name)
429431
c.loadPostgresTeams()

0 commit comments

Comments
 (0)