Skip to content

Commit daa7f74

Browse files
author
Ryan
committed
added _check call to getServerAddress if _it is null - JAVA-467
1 parent 4e02a28 commit daa7f74

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/com/mongodb/DBCursor.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,14 @@ public DBCollection getCollection(){
678678
* @return
679679
*/
680680
public ServerAddress getServerAddress() {
681-
if (_it != null) {
682-
if (_it instanceof DBApiLayer.Result)
683-
return ((DBApiLayer.Result)_it).getServerAddress();
684-
}
681+
if (_it != null && _it instanceof DBApiLayer.Result)
682+
return ((DBApiLayer.Result)_it).getServerAddress();
683+
684+
_check();
685+
686+
if (_it != null && _it instanceof DBApiLayer.Result)
687+
return ((DBApiLayer.Result)_it).getServerAddress();
688+
685689
return null;
686690
}
687691

0 commit comments

Comments
 (0)