CORD-2470 Fix NPEs
Change-Id: Ic31725905d0410ed2abdd8b87991c8cc362457f8
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
index a131e4a..80affc1 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
@@ -537,7 +537,7 @@
.forEach(entry -> {
ConnectPoint source = getSource(entry.getKey().mcastIp());
removeGroupFromDevice(entry.getKey().deviceId(), entry.getKey().mcastIp(),
- assignedVlan(deviceId.equals(source.deviceId()) ? source : null));
+ assignedVlan(source != null && deviceId.equals(source.deviceId()) ? source : null));
mcastNextObjStore.remove(entry.getKey());
});
log.debug("{} is removed from mcastNextObjStore", deviceId);
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index f955857..cec93a7 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -423,6 +423,9 @@
cfgService.registerConfigFactory(xConnectConfigFactory);
cfgService.registerConfigFactory(mcastConfigFactory);
cfgService.registerConfigFactory(pwaasConfigFactory);
+
+ cfgListener.configureNetwork();
+
hostService.addListener(hostListener);
packetService.addProcessor(processor, PacketProcessor.director(2));
linkService.addListener(linkListener);
@@ -430,8 +433,6 @@
multicastRouteService.addListener(mcastListener);
routeService.addListener(routeListener);
- cfgListener.configureNetwork();
-
log.info("Started");
}