Sonar suggestions - fixes to potential null pointer dereferences

Change-Id: I4e350a9d72a9322971d5d4f831f1bdf167986b87
diff --git a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 0725e1b..4610f4a 100644
--- a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -1295,7 +1295,7 @@
         // not change if the link is a parallel link (same src-dst as another link.
         // However we still need to update ECMP hash groups to include new buckets
         // for the link that has come up.
-        if (mastershipService.isLocalMaster(link.src().deviceId())) {
+        if (groupHandler != null && mastershipService.isLocalMaster(link.src().deviceId())) {
             if (!seenBefore && isParallelLink(link)) {
                 // if link seen first time, we need to ensure hash-groups have all ports
                 log.debug("Attempting retryHash for paralled first-time link {}", link);