Skip to content

Commit 87dcbcf

Browse files
committed
- fixed the crash when *time.Time in the struct and nil value
1 parent 03d16bb commit 87dcbcf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bson/bsoncodec/struct_codec.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ func (sc *StructCodec) isZero(i interface{}) bool {
231231
return true
232232
}
233233

234+
if v.Kind() == reflect.Ptr && v.IsNil() {
235+
return true
236+
}
237+
234238
if z, ok := v.Interface().(Zeroer); ok {
235239
return z.IsZero()
236240
}

0 commit comments

Comments
 (0)