bgpd: improve cleanup in bgp_delete()

Signed-off-by: Lou Berger <lberger@labn.net>
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 7555ca7..b449cae 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -2295,6 +2295,9 @@
   struct bgp_node *bn;
   struct bgp_static *bgp_static;
 
+  if (bm->bgp == NULL)          /* may be called during cleanup */
+    return;
+
   /* For neighbor route-map updates. */
   for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
     {