olsr_spf: fix potential null pointer dereference warnings on gcc 7
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 21 Nov 2017 08:37:11 +0000 (09:37 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 21 Nov 2017 09:11:13 +0000 (10:11 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/olsr_spf.c

index 130d9a9..dfc0d98 100644 (file)
@@ -471,7 +471,7 @@ olsr_calculate_routing_table(bool force)
   for (; !list_is_empty(&path_list); list_remove(path_list.next)) {
 
     tc = pathlist2tc(path_list.next);
-    link = tc->next_hop;
+    link = tc ? tc->next_hop : NULL;
 
     if (!link) {
 #ifdef DEBUG