diff --git a/nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/main/java/org/apache/nifi/py4j/PythonProcess.java b/nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/main/java/org/apache/nifi/py4j/PythonProcess.java index 3cfb2b30f4..2e4779bfab 100644 --- a/nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/main/java/org/apache/nifi/py4j/PythonProcess.java +++ b/nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/main/java/org/apache/nifi/py4j/PythonProcess.java @@ -361,7 +361,9 @@ public class PythonProcess { } private synchronized void killProcess() { - StandardLogLevelChangeHandler.getHandler().removeListener(logListenerId); + if (logListenerId != null) { + StandardLogLevelChangeHandler.getHandler().removeListener(logListenerId); + } if (server != null) { try {