Skip to content

Commit

Permalink
GODRIVER-3009 Fix nil encoder/decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Nov 21, 2023
1 parent f93a990 commit 0153eef
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions bson/bsoncodec/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,10 @@ func (r *Registry) LookupEncoder(valueType reflect.Type) (ValueEncoder, error) {
if found {
return r.typeEncoders.LoadOrStore(valueType, enc), nil
}
if valueType == nil {
r.storeTypeEncoder(valueType, nil)
return nil, ErrNoEncoder{Type: valueType}
}

if v, ok := r.kindEncoders.Load(valueType.Kind()); ok {
return r.storeTypeEncoder(valueType, v), nil
}
r.storeTypeEncoder(valueType, nil)
return nil, ErrNoEncoder{Type: valueType}
}

Expand Down Expand Up @@ -474,7 +469,6 @@ func (r *Registry) LookupDecoder(valueType reflect.Type) (ValueDecoder, error) {
if v, ok := r.kindDecoders.Load(valueType.Kind()); ok {
return r.storeTypeDecoder(valueType, v), nil
}
r.storeTypeDecoder(valueType, nil)
return nil, ErrNoDecoder{Type: valueType}
}

Expand Down

0 comments on commit 0153eef

Please sign in to comment.