Skip to content

Commit 16cda52

Browse files
committed
Merge branch 'pr/95'
GODRIVER-596 Change-Id: Ib38f020b5dacddb50a7fb9eb9bae0ac227b9d816
2 parents fea1a37 + 6c2ca30 commit 16cda52

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bson/bsoncodec/struct_codec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ func (sc *StructCodec) DecodeValue(r DecodeContext, vr ValueReader, i interface{
220220

221221
func (sc *StructCodec) isZero(i interface{}) bool {
222222
v := reflect.ValueOf(i)
223+
224+
// check the value validity
225+
if !v.IsValid() {
226+
return true
227+
}
228+
223229
if z, ok := v.Interface().(bson.Zeroer); ok {
224230
return z.IsZero()
225231
}

0 commit comments

Comments
 (0)