Fix NPE on shutdown if providers are already gone
Change-Id: I019786f26a589a5b82b72f736fa2d148571ea274
diff --git a/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java b/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
index ea94686..df5c6a1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
@@ -74,7 +74,6 @@
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
-import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.DefaultAnnotations.merge;
import static org.onosproject.net.DefaultAnnotations.union;
import static org.onosproject.net.Link.State.ACTIVE;
@@ -353,7 +352,12 @@
private Link composeLink(LinkKey linkKey) {
- ProviderId baseProviderId = checkNotNull(getBaseProviderId(linkKey));
+ ProviderId baseProviderId = getBaseProviderId(linkKey);
+ if (baseProviderId == null) {
+ // provider was not found, this means it was already removed by the
+ // parent component.
+ return null;
+ }
LinkDescription base = linkDescriptions.get(new Provided<>(linkKey, baseProviderId));
// short circuit if link description no longer exists
if (base == null) {