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

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


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

commit 4b03fe1343428dc9424a75b5840199fb2f142ac0
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 b145f2014a..7bcc2cd530 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -2073,11 +2073,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