From c9de83332e8fc47c98757fe235f367e80e0516c9 Mon Sep 17 00:00:00 2001 From: Terry Chow Date: Fri, 30 Dec 2022 13:48:57 -0800 Subject: [PATCH] Added null check --- .../microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java index 8ebe9789e..8aa67b726 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java @@ -2981,8 +2981,9 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand) th if (null == batchCommand.batchException) batchCommand.batchException = e; - if (batchCommand.batchException.getSQLState() - .equals(SQLState.STATEMENT_CANCELED.getSQLStateCode())) { + String sqlState = batchCommand.batchException.getSQLState(); + if (null != sqlState + && sqlState.equals(SQLState.STATEMENT_CANCELED.getSQLStateCode())) { processBatch(); continue; }