From e66d69d4fa9cb10362c5f4ba7e7d3c1cd4005973 Mon Sep 17 00:00:00 2001
From: Mathieu <mathieu.hautebas@harfanglab.fr>
Date: Mon, 16 Feb 2026 14:25:14 +0100
Subject: [PATCH] Add null checks for iface before accessing index in
 mpnh_compare_node

---
 nest/rt-attr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index e10e1ecb..1fb93f8e 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -255,6 +255,12 @@ nexthop_compare_node(const struct nexthop *x, const struct nexthop *y)
       return r;
   }
 
+  if (!x->iface)
+    return 1;
+
+  if (!y->iface)
+    return -1;
+
   return ((int) x->iface->index) - ((int) y->iface->index);
 }
 
-- 
2.34.1

