Fix npe when host does not have valid ipv6 address
Change-Id: I411ec372eb16a1a2b5071a79b81af173de25bdbd
(cherry picked from commit 13b2cc62251e15b391f76507a2afc1cb470b6d37)
diff --git a/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java b/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
index 64fe2a0..5726f56 100644
--- a/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
+++ b/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
@@ -170,7 +170,7 @@
IpAddress ipAddress;
if (ipv4) {
Criterion.Type type = src ? Criterion.Type.IPV4_SRC : Criterion.Type.IPV4_DST;
- if (trace.getInitialPacket().getCriterion(type) != null) {
+ if (trace.getInitialPacket() != null && trace.getInitialPacket().getCriterion(type) != null) {
ipAddress = ((IPCriterion) trace.getInitialPacket()
.getCriterion(type)).ip().address();
} else {
@@ -179,7 +179,7 @@
}
} else {
Criterion.Type type = src ? Criterion.Type.IPV6_SRC : Criterion.Type.IPV6_DST;
- if (trace.getInitialPacket().getCriterion(type) != null) {
+ if (trace.getInitialPacket() != null && trace.getInitialPacket().getCriterion(type) != null) {
ipAddress = ((IPCriterion) trace.getInitialPacket()
.getCriterion(type)).ip().address();
} else {