Skip to content

Commit c35b076

Browse files
authored
Return result error from SingleResult before nil registry check
1 parent 8051092 commit c35b076

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mongo/single_result.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ type SingleResult struct {
3333
// will be returned. If there were no returned documents, ErrNoDocuments is
3434
// returned.
3535
func (sr *SingleResult) Decode(v interface{}) error {
36+
if sr.err != nil {
37+
return sr.err
38+
}
3639
if sr.reg == nil {
3740
return bson.ErrNilRegistry
3841
}

0 commit comments

Comments
 (0)