Browse Source

models2: Fixed error caused by empty change set in edit

1.0
Gisle Aune 6 years ago
parent
commit
7aa0de9135
  1. 4
      models/characters/edit.go

4
models/characters/edit.go

@ -23,6 +23,10 @@ func Edit(character models.Character, name, shortName, description *string) (mod
changes["description"] = *description changes["description"] = *description
} }
if len(changes) == 0 {
return character, nil
}
err := collection.UpdateId(character.ID, bson.M{"$set": changes}) err := collection.UpdateId(character.ID, bson.M{"$set": changes})
if err != nil { if err != nil {
return models.Character{}, err return models.Character{}, err

Loading…
Cancel
Save