Protect against NPE in DefaultSubscriptionRegistry

Follow-up fix on the recent commit:
https://github.com/spring-projects/spring-framework/commit/4fc41e

Issue: SPR-15543
This commit is contained in:
Rossen Stoyanchev 2017-05-22 16:08:22 -04:00
parent 0f8bf10aa8
commit 8deec9569c
1 changed files with 2 additions and 1 deletions

View File

@ -293,7 +293,8 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
if (getPathMatcher().match(destination, cachedDestination)) {
LinkedMultiValueMap<String, String> subs = entry.getValue();
// Subscription id's may also be populated via getSubscriptions()
if (!subs.containsKey(sessionId) || !subs.get(sessionId).contains(subsId)) {
List<String> subsForSession = subs.get(sessionId);
if (subsForSession == null || !subsForSession.contains(subsId)) {
subs.add(sessionId, subsId);
this.accessCache.put(cachedDestination, subs.deepCopy());
}