models2: Fixed error caused by empty change set in edit
the build failed

This commit is contained in:
2018-10-06 14:02:39 +02:00
parent 6dfbee7ff2
commit 7aa0de9135
+4
View File
@@ -23,6 +23,10 @@ func Edit(character models.Character, name, shortName, description *string) (mod
changes["description"] = *description
}
if len(changes) == 0 {
return character, nil
}
err := collection.UpdateId(character.ID, bson.M{"$set": changes})
if err != nil {
return models.Character{}, err