diff --git a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsBodyExecution.java b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsBodyExecution.java index 60518121d..1744304c7 100644 --- a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsBodyExecution.java +++ b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsBodyExecution.java @@ -249,6 +249,9 @@ public boolean cancel(Throwable error) { t.getExecution().runInCpsVmThread(new FutureCallback<>() { @Override public void onSuccess(CpsThreadGroup g) { + if (thread == null) { + return; + } // Similar to getCurrentExecutions but we want the raw CpsThread, not a StepExecution; cf. CpsFlowExecution.interrupt Map m = new LinkedHashMap<>(); for (CpsThread t : thread.group.getThreads()) {