From 1cadfc64462948f3f746924e72bb92b150d67a4c Mon Sep 17 00:00:00 2001 From: Anthony Milbourne <18662115+amilbourne@users.noreply.github.com> Date: Fri, 23 Dec 2022 23:36:05 +0000 Subject: [PATCH] Fix for Bug #108415 - Occasional NPE when server dies --- src/main/core-impl/java/com/mysql/cj/AbstractQuery.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/core-impl/java/com/mysql/cj/AbstractQuery.java b/src/main/core-impl/java/com/mysql/cj/AbstractQuery.java index b4505ec76..3c6345948 100644 --- a/src/main/core-impl/java/com/mysql/cj/AbstractQuery.java +++ b/src/main/core-impl/java/com/mysql/cj/AbstractQuery.java @@ -225,7 +225,9 @@ public void stopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelRea throw ExceptionFactory.createException(t.getMessage(), t); } - this.session.getCancelTimer().purge(); + if (this.session != null) { + this.session.getCancelTimer().purge(); + } if (checkCancelTimeout) { checkCancelTimeout();