diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 0b41244..5f89039 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -805,6 +805,9 @@ static inline int
 bgp_set_next_hop(struct bgp_proto *p, rta *a)
 {
   struct eattr *nh = ea_find(a->eattrs, EA_CODE(EAP_BGP, BA_NEXT_HOP));
+  if (!nh)
+    return 0;
+
   ip_addr *nexthop = (ip_addr *) nh->u.ptr->data;
 
 #ifdef IPV6
