Skip to content

Commit 07458f9

Browse files
committed
[JAVA-258]: prevent getLastError from being called in toString()
1 parent 56e7a91 commit 07458f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/com/mongodb/WriteResult.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ public boolean isLazy(){
138138

139139
@Override
140140
public String toString(){
141-
return getLastError().toString();
141+
CommandResult res = getCachedLastError();
142+
if (res != null)
143+
return res.toString();
144+
return "N/A";
142145
}
143146

144147
private long _lastCall;

0 commit comments

Comments
 (0)