[GODRIVER-245] Ensure methods of *Document handle the case where *Document is nil Created: 15/Feb/18  Updated: 28/Oct/23  Resolved: 23/Feb/18

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: 0.0.1
Fix Version/s: 0.0.2

Type: Bug Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Samuel Rossi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: GODRIVER Alpha 2 UX

 Description   

Currently, when *bson.Document is nil and we call methods on it, strange things happen, like panics during validation. For the methods of bson.Document that have a pointer receiver, add a check to ensure that the document itself is not nil and if it is either panic or return an error.

For certain cases (like printing out the Document), we may want to print "<nil>" instead of return an error, or some other representation of a nil Document.



 Comments   
Comment by Githook User [ 23/Feb/18 ]

Author:

{'email': 'saghmrossi@gmail.com', 'name': 'Saghm Rossi', 'username': 'saghm'}

Message: GODRIVER-245 Ensure methods of *Document handle the case where receiver is nil

Change-Id: I2a5c6eb6118e3f057475a98bac87e4946beee0e7
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/6de8d71a9d14ad3107688aaf996acce828656708

Comment by Samuel Rossi (Inactive) [ 22/Feb/18 ]

Code review url: https://review.gerrithub.io/c/401062/

Generated at Thu Feb 08 08:33:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.