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

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 5b1c459bbf Avoid IDE warning for NPE
5b1c459bbf is described below

commit 5b1c459bbf52a8620865d39ceb2ad2517c1ce53b
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Jun 26 20:19:35 2026 +0100

    Avoid IDE warning for NPE
---
 java/org/apache/catalina/mbeans/ContainerMBean.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/mbeans/ContainerMBean.java 
b/java/org/apache/catalina/mbeans/ContainerMBean.java
index 0e900a9c4e..d64b4b9f64 100644
--- a/java/org/apache/catalina/mbeans/ContainerMBean.java
+++ b/java/org/apache/catalina/mbeans/ContainerMBean.java
@@ -85,7 +85,9 @@ public class ContainerMBean extends 
BaseCatalinaMBean<ContainerBase> {
             contained.init();
         } catch (LifecycleException e) {
             // If init fails, try to cleanup since the MBean may not have been 
added
-            container.removeChild(contained);
+            if (container != null) {
+                container.removeChild(contained);
+            }
             throw new MBeanException(e);
         }
     }


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

Reply via email to