[SERVER-11156] Useless code in shell save() function Created: 12/Oct/13 Updated: 07/Apr/23 Resolved: 18/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.4.6 |
| Fix Version/s: | 2.5.4 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Frédéric G. MARAND | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | neweng, pull-request | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux |
||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | Linux |
| Steps To Reproduce: | launch shell |
| Participants: |
| Description |
|
save() starts by this: if ( obj == null || typeof( obj ) == "undefined" ) This is apparently to catch both null and undefined. However, since the first check only uses == instead of ===, it matches undefined, and the second part of the check is never used. This could be improved in one of two ways:
|
| Comments |
| Comment by auto [ 18/Oct/13 ] |
|
Author: {u'username': u'FGM', u'name': u'Frederic G. MARAND', u'email': u'fgm@osinet.fr'}Message: Signed-off-by: Matt Kangas <matt.kangas@mongodb.com> |
| Comment by Frédéric G. MARAND [ 16/Oct/13 ] |
|
Just sent a pull request https://github.com/mongodb/mongo/pull/521 |
| Comment by Daniel Pasette (Inactive) [ 15/Oct/13 ] |
|
could just drop the second compare as it's implied by the (obj == null). |