summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-01-30 11:44:30 -0500
committerEliot Horowitz <eliot@10gen.com>2011-01-30 11:44:30 -0500
commit55637a2881455cde1483c7f4d9fdf0ee36ea4328 (patch)
tree0ecece395b2bcb501a7c48c5c3062d9d89cf6ec2 /tools
parentf4c3936ebc081e69244892f472ef2670eed3f1d0 (diff)
downloadmongo-55637a2881455cde1483c7f4d9fdf0ee36ea4328.tar.gz
safer checks in mongostat SERVER-2438
Diffstat (limited to 'tools')
-rw-r--r--tools/stat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/stat.cpp b/tools/stat.cpp
index 5d00e508ec3..9882565a162 100644
--- a/tools/stat.cpp
+++ b/tools/stat.cpp
@@ -196,7 +196,7 @@ namespace mongo {
BSONObj doRow( const BSONObj& a , const BSONObj& b ) {
BSONObjBuilder result;
- if ( b["opcounters"].type() == Object ) {
+ if ( a["opcounters"].isABSONObj() && b["opcounters"].isABSONObj() ) {
BSONObj ax = a["opcounters"].embeddedObject();
BSONObj bx = b["opcounters"].embeddedObject();
@@ -285,7 +285,7 @@ namespace mongo {
_append( result , "ar|aw" , 7 , temp.str() );
}
- if ( b["network"].isABSONObj() ) {
+ if ( a["network"].isABSONObj() && b["network"].isABSONObj() ) {
BSONObj ax = a["network"].embeddedObject();
BSONObj bx = b["network"].embeddedObject();
_appendNet( result , "netIn" , diff( "bytesIn" , ax , bx ) );