File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
driver-core/src/main/com/mongodb/operation Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -142,13 +142,15 @@ private void killCursor() {
142142 localConnectionSource .getConnection (new SingleResultCallback <AsyncConnection >() {
143143 @ Override
144144 public void onResult (final AsyncConnection connection , final Throwable connectionException ) {
145- connection .killCursorAsync (singletonList (localCursor .getId ()), new SingleResultCallback <Void >() {
146- @ Override
147- public void onResult (final Void result , final Throwable t ) {
148- connection .release ();
149- localConnectionSource .release ();
150- }
151- });
145+ if (connection != null ) {
146+ connection .killCursorAsync (singletonList (localCursor .getId ()), new SingleResultCallback <Void >() {
147+ @ Override
148+ public void onResult (final Void result , final Throwable t ) {
149+ connection .release ();
150+ localConnectionSource .release ();
151+ }
152+ });
153+ }
152154 }
153155 });
154156 } else if (connectionSource != null ) {
You can’t perform that action at this time.
0 commit comments