Sonar suggestions - fixes to potential null pointer dereferences

Change-Id: I4e350a9d72a9322971d5d4f831f1bdf167986b87
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpReachNlri.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpReachNlri.java
index 106c4bb..578f4fe 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpReachNlri.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpReachNlri.java
@@ -447,7 +447,7 @@
             if (listIterator.hasNext()) {
                 tlv1 = listIterator.next();
             }
-            while (listIterator.hasNext()) {
+            while (tlv1 != null && listIterator.hasNext()) {
                 BgpValueType tlv = listIterator.next();
                 if (tlv.getType() != tlv1.getType()) {
                     isAllFlowTypesIdentical = false;
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpUnReachNlri.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpUnReachNlri.java
index e06fb0a..ac63ba7 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpUnReachNlri.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/MpUnReachNlri.java
@@ -402,7 +402,7 @@
             if (listIterator.hasNext()) {
                 tlv1 = listIterator.next();
             }
-            while (listIterator.hasNext()) {
+            while (tlv1 != null && listIterator.hasNext()) {
                 BgpValueType tlv = listIterator.next();
                 if (tlv.getType() != tlv1.getType()) {
                     isAllFlowTypesIdentical = false;