diff options
author | Andrew Morrow <acm@mongodb.com> | 2014-12-05 16:45:07 -0500 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2014-12-06 13:03:46 -0500 |
commit | a6788ec72a9dabb38bd92a8ab653e32034e9e02e (patch) | |
tree | ff4d51e3e64ce16b396020a30fffd3c69d9d93aa /src/mongo/bson | |
parent | ee6fa9cf4870f81de1a4005cce2be6a91ac551ac (diff) | |
download | mongo-a6788ec72a9dabb38bd92a8ab653e32034e9e02e.tar.gz |
SERVER-16427 Return a correct empty StringData for fieldNameStringData on EOO
Diffstat (limited to 'src/mongo/bson')
-rw-r--r-- | src/mongo/bson/bsonelement.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h index 5cbfadc434f..e9d4e4b1939 100644 --- a/src/mongo/bson/bsonelement.h +++ b/src/mongo/bson/bsonelement.h @@ -169,7 +169,7 @@ namespace mongo { } const StringData fieldNameStringData() const { - return StringData(fieldName(), fieldNameSize() - 1); + return StringData(fieldName(), eoo() ? 0 : fieldNameSize() - 1); } /** raw data of the element's value (so be careful). */ @@ -647,8 +647,8 @@ namespace mongo { } inline BSONElement::BSONElement() { - static char z = 0; - data = &z; + static const char kEooElement[] = ""; + data = kEooElement; fieldNameSize_ = 0; totalSize = 1; } |