aboutsummaryrefslogtreecommitdiffstats
path: root/models/org_team.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/org_team.go')
-rw-r--r--models/org_team.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/models/org_team.go b/models/org_team.go
index f8013d12c6..82c27b2c06 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -1072,12 +1072,14 @@ func UpdateTeamUnits(team *Team, units []TeamUnit) (err error) {
return err
}
- if _, err = sess.Insert(units); err != nil {
- errRollback := sess.Rollback()
- if errRollback != nil {
- log.Error("UpdateTeamUnits sess.Rollback: %v", errRollback)
+ if len(units) > 0 {
+ if _, err = sess.Insert(units); err != nil {
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("UpdateTeamUnits sess.Rollback: %v", errRollback)
+ }
+ return err
}
- return err
}
return sess.Commit()