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 de34e82e6a Avoid potential NPE
de34e82e6a is described below
commit de34e82e6ae7bc15ab6a76d886f3ef2f1f4587fb
Author: Mark Thomas <[email protected]>
AuthorDate: Tue May 26 18:21:56 2026 +0100
Avoid potential NPE
---
java/org/apache/catalina/realm/JAASMemoryLoginModule.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
index e60a900b25..72decd13a1 100644
--- a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
+++ b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
@@ -318,8 +318,10 @@ public class JAASMemoryLoginModule extends MemoryRealm
implements LoginModule {
public boolean logout() throws LoginException {
subject.getPrincipals().remove(principal);
if (principal instanceof GenericPrincipal) {
- for (Principal role : roles) {
- subject.getPrincipals().remove(role);
+ if (roles != null) {
+ for (Principal role : roles) {
+ subject.getPrincipals().remove(role);
+ }
}
}
committed = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]