diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java index 32588c012..4e0752aeb 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java @@ -6560,7 +6560,7 @@ private boolean nextPacket() throws SQLServerException { if (null == consumedPacket.next) { // if the read comes from getNext() and responseBuffering is Adaptive (in this place is), then reset Counter // State - if (command.getTDSWriter().checkIfTdsMessageTypeIsBatchOrRPC()) { + if (null != command && command.getTDSWriter().checkIfTdsMessageTypeIsBatchOrRPC()) { command.getCounter().resetCounter(); } readPacket();