Madan Jampani

Fixes NPE in ECLinkStore seen during topology shutdown

Change-Id: Iabd22126a940dfb8983ff40c4a43b23e068a273f
...@@ -317,6 +317,9 @@ public class ECLinkStore ...@@ -317,6 +317,9 @@ public class ECLinkStore
317 AtomicReference<LinkEvent.Type> eventType = new AtomicReference<>(); 317 AtomicReference<LinkEvent.Type> eventType = new AtomicReference<>();
318 Link link = links.compute(linkKey, (key, existingLink) -> { 318 Link link = links.compute(linkKey, (key, existingLink) -> {
319 Link newLink = composeLink(linkKey); 319 Link newLink = composeLink(linkKey);
320 + if (newLink == null) {
321 + return null;
322 + }
320 if (existingLink == null) { 323 if (existingLink == null) {
321 eventType.set(LINK_ADDED); 324 eventType.set(LINK_ADDED);
322 return newLink; 325 return newLink;
...@@ -352,7 +355,10 @@ public class ECLinkStore ...@@ -352,7 +355,10 @@ public class ECLinkStore
352 355
353 ProviderId baseProviderId = checkNotNull(getBaseProviderId(linkKey)); 356 ProviderId baseProviderId = checkNotNull(getBaseProviderId(linkKey));
354 LinkDescription base = linkDescriptions.get(new Provided<>(linkKey, baseProviderId)); 357 LinkDescription base = linkDescriptions.get(new Provided<>(linkKey, baseProviderId));
355 - 358 + // short circuit if link description no longer exists
359 + if (base == null) {
360 + return null;
361 + }
356 ConnectPoint src = base.src(); 362 ConnectPoint src = base.src();
357 ConnectPoint dst = base.dst(); 363 ConnectPoint dst = base.dst();
358 Type type = base.type(); 364 Type type = base.type();
......