This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 2f1baec084 Avoid possible NPE
2f1baec084 is described below

commit 2f1baec0843e00f4261d48425ab52869187f79c4
Author: remm <[email protected]>
AuthorDate: Fri May 15 14:04:42 2026 +0200

    Avoid possible NPE
    
    init uses if (this.domain != null) so destroy should do the same thing.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index a0c1924ebb..8746597182 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -2139,11 +2139,13 @@ public abstract class AbstractEndpoint<S, U> {
             unbind();
             bindState = BindState.UNBOUND;
         }
-        Registry registry = Registry.getRegistry(null);
-        registry.unregisterComponent(oname);
-        registry.unregisterComponent(socketProperties.getObjectName());
-        for (SSLHostConfig sslHostConfig : findSslHostConfigs()) {
-            unregisterJmx(sslHostConfig);
+        if (this.domain != null) {
+            Registry registry = Registry.getRegistry(null);
+            registry.unregisterComponent(oname);
+            registry.unregisterComponent(socketProperties.getObjectName());
+            for (SSLHostConfig sslHostConfig : findSslHostConfigs()) {
+                unregisterJmx(sslHostConfig);
+            }
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to