Skip to content

Commit b6e2524

Browse files
committed
Protect against NPE in DefaultSubscriptionRegistry
Follow-up fix on the recent commit: 44c31a Issue: SPR-15543
1 parent b64de87 commit b6e2524

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ public void updateAfterNewSubscription(String destination, String sessionId, Str
293293
if (getPathMatcher().match(destination, cachedDestination)) {
294294
LinkedMultiValueMap<String, String> subs = entry.getValue();
295295
// Subscription id's may also be populated via getSubscriptions()
296-
if (!subs.containsKey(sessionId) || !subs.get(sessionId).contains(subsId)) {
296+
List<String> subsForSession = subs.get(sessionId);
297+
if (subsForSession == null || !subsForSession.contains(subsId)) {
297298
subs.add(sessionId, subsId);
298299
this.accessCache.put(cachedDestination, subs.deepCopy());
299300
}

0 commit comments

Comments
 (0)