Fix potential panic (#2289)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
This commit is contained in:
		
							parent
							
								
									0e7beb5fe5
								
							
						
					
					
						commit
						fc86c44ec3
					
				|  | @ -415,6 +415,7 @@ func (c *Controller) postgresTeamAdd(obj interface{}) { | ||||||
| 	pgTeam, ok := obj.(*acidv1.PostgresTeam) | 	pgTeam, ok := obj.(*acidv1.PostgresTeam) | ||||||
| 	if !ok { | 	if !ok { | ||||||
| 		c.logger.Errorf("could not cast to PostgresTeam spec") | 		c.logger.Errorf("could not cast to PostgresTeam spec") | ||||||
|  | 		return | ||||||
| 	} | 	} | ||||||
| 	c.logger.Debugf("PostgreTeam %q added. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name) | 	c.logger.Debugf("PostgreTeam %q added. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name) | ||||||
| 	c.loadPostgresTeams() | 	c.loadPostgresTeams() | ||||||
|  | @ -424,6 +425,7 @@ func (c *Controller) postgresTeamUpdate(prev, obj interface{}) { | ||||||
| 	pgTeam, ok := obj.(*acidv1.PostgresTeam) | 	pgTeam, ok := obj.(*acidv1.PostgresTeam) | ||||||
| 	if !ok { | 	if !ok { | ||||||
| 		c.logger.Errorf("could not cast to PostgresTeam spec") | 		c.logger.Errorf("could not cast to PostgresTeam spec") | ||||||
|  | 		return | ||||||
| 	} | 	} | ||||||
| 	c.logger.Debugf("PostgreTeam %q updated. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name) | 	c.logger.Debugf("PostgreTeam %q updated. Reloading postgres team CRDs and overwriting cached map", pgTeam.Name) | ||||||
| 	c.loadPostgresTeams() | 	c.loadPostgresTeams() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue