good morning!!!!

Skip to content
Snippets Groups Projects
Commit dd1b6f24 authored by Maciej Lisiewski's avatar Maciej Lisiewski
Browse files

add missing ObjectId validity check

parent 3f6747b9
Branches
Tags
No related merge requests found
...@@ -347,10 +347,12 @@ func getId(item interface{}) bson.ObjectId { ...@@ -347,10 +347,12 @@ func getId(item interface{}) bson.ObjectId {
} }
if fieldName != "" { if fieldName != "" {
if bsonId, ok := v.FieldByName(fieldName).Interface().(bson.ObjectId); ok { if bsonId, ok := v.FieldByName(fieldName).Interface().(bson.ObjectId); ok {
if bsonId.Valid() {
return bsonId return bsonId
} }
} }
} }
}
return bson.NewObjectId() return bson.NewObjectId()
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment