Fix NPE thrown when searching multiple routes and IP is null

Change-Id: I3f3f45285c8d4be7106e397c83f18c5e56d9ec21
(cherry picked from commit c07125d728ff0f1778e43ed2c2cda0c962a5a1c3)
diff --git a/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java b/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
index cf40de9..4f22f97 100644
--- a/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
+++ b/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
@@ -918,12 +918,13 @@
         } else if (trace.getInitialPacket().getCriterion(Criterion.Type.IPV6_DST) != null) {
             ip = ((IPCriterion) trace.getInitialPacket().getCriterion(Criterion.Type.IPV6_DST)).ip().address();
         }
-
-        Optional<ResolvedRoute> optionalRoute = routeService.longestPrefixLookup(ip);
-        if (ip != null && optionalRoute.isPresent()) {
-            ResolvedRoute route = optionalRoute.get();
-            route.prefix();
-            multipleRoutes = routeService.getAllResolvedRoutes(route.prefix()).size() > 1;
+        if (ip != null) {
+            Optional<ResolvedRoute> optionalRoute = routeService.longestPrefixLookup(ip);
+            if (optionalRoute.isPresent()) {
+                ResolvedRoute route = optionalRoute.get();
+                route.prefix();
+                multipleRoutes = routeService.getAllResolvedRoutes(route.prefix()).size() > 1;
+            }
         }
         return multipleRoutes;
     }