Better error handling

Change-Id: Iac5934a89b177f4e0207a6ecc2e2f0731aca115e
diff --git a/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java b/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
index b3a0aca..af62525 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
@@ -102,6 +102,11 @@
         // ARP request for router. Send ARP reply.
         if (isArpForRouter(pkt)) {
             MacAddress targetMac = config.getRouterMacForAGatewayIp(pkt.target().getIp4Address());
+            if (targetMac == null) {
+                log.warn("Router MAC of {} is not configured. Cannot handle ARP request from {}",
+                        pkt.inPort().deviceId(), pkt.sender());
+                return;
+            }
             sendResponse(pkt, targetMac, hostService);
         } else {
             // NOTE: Ignore ARP packets except those target for the router
diff --git a/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java b/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
index b305c5e..3ec8b23 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
@@ -328,6 +328,11 @@
         if (isNdpForGateway(pkt)) {
             log.trace("Sending NDP reply on behalf of gateway IP for pkt: {}", pkt.target());
             MacAddress routerMac = config.getRouterMacForAGatewayIp(pkt.target());
+            if (routerMac == null) {
+                log.warn("Router MAC of {} is not configured. Cannot handle NDP request from {}",
+                        pkt.inPort().deviceId(), pkt.sender());
+                return;
+            }
             sendResponse(pkt, routerMac, hostService);
         } else {