diff options
author | gregs <greg@10gen.com> | 2011-05-27 19:42:44 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-05-27 20:21:10 -0400 |
commit | 7b2eaf5c4c35132c5eee86c902612201ee963b0f (patch) | |
tree | 6aeec55ed4f90783032b5391d61f33f8f6849874 | |
parent | a23295b084353800481caf00c92bea1ec024b664 (diff) | |
download | mongo-7b2eaf5c4c35132c5eee86c902612201ee963b0f.tar.gz |
check if master is null CS-596
-rw-r--r-- | client/dbclient_rs.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/client/dbclient_rs.cpp b/client/dbclient_rs.cpp index ce8e9f27d5e..ae01da3e5b3 100644 --- a/client/dbclient_rs.cpp +++ b/client/dbclient_rs.cpp @@ -438,7 +438,7 @@ namespace mongo { DBClientConnection * DBClientReplicaSet::checkMaster() { HostAndPort h = _monitor->getMaster(); - if ( h == _masterHost ) { + if ( h == _masterHost && _master ) { // a master is selected. let's just make sure connection didn't die if ( ! _master->isFailed() ) return _master.get(); @@ -459,7 +459,7 @@ namespace mongo { DBClientConnection * DBClientReplicaSet::checkSlave() { HostAndPort h = _monitor->getSlave( _slaveHost ); - if ( h == _slaveHost ) { + if ( h == _slaveHost && _slave ) { if ( ! _slave->isFailed() ) return _slave.get(); _monitor->notifySlaveFailure( _slaveHost ); |