Fix npe when adding a null element in a collection

Change-Id: I946e0c911e100ffcbf123eb6bef44c26c31a46cc
(cherry picked from commit 4bcc32231a6ad94d6f3ea43180b0b5d1e92dbd4e)
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
index 6d8495d..50d0969d 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
@@ -972,9 +972,12 @@
             // If previously it had two locations, we need to recover it
             // Filter out if the remaining location is already served
             if (prevSinks.containsKey(hostId) && prevSinks.get(hostId).size() == 2) {
-                sinksToBeProcessed.add(connectPoints.stream()
-                                               .filter(connectPoint -> !isSink(mcastIp, connectPoint))
-                                               .findFirst().orElseGet(null));
+                ConnectPoint sinkToBeProcessed = connectPoints.stream()
+                        .filter(connectPoint -> !isSink(mcastIp, connectPoint))
+                        .findFirst().orElse(null);
+                if (sinkToBeProcessed != null) {
+                    sinksToBeProcessed.add(sinkToBeProcessed);
+                }
             }
         });
         return sinksToBeProcessed;
@@ -1004,7 +1007,7 @@
             // If it has one location, just use it
             if (connectPoints.size() == 1) {
                 sinksToBeProcessed.add(connectPoints.stream()
-                                               .findFirst().orElseGet(null));
+                                               .findFirst().orElse(null));
                 return;
             }
             // We prefer to reuse existing flows
@@ -1034,7 +1037,7 @@
             }
             // Finally, we randomly pick a new location
             sinksToBeProcessed.add(connectPoints.stream()
-                                           .findFirst().orElseGet(null));
+                                           .findFirst().orElse(null));
         }));
         // We have done, return the set
         return sinksToBeProcessed;