From e4e783a0eb13d945b651f400f869cd1edead8f17 Mon Sep 17 00:00:00 2001 From: Terry <32403408+tkyc@users.noreply.github.com> Date: Fri, 30 Dec 2022 13:59:58 -0800 Subject: [PATCH] Added null check (#2032) --- .../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 bcad5a538..90c2712c3 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java @@ -2972,8 +2972,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; }