txtinfo: avoid a potential null deref in links
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 20 Feb 2016 10:55:24 +0000 (11:55 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sun, 21 Feb 2016 12:23:40 +0000 (13:23 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/txtinfo/src/olsrd_txtinfo.c

index 52a1efe..28d24d6 100644 (file)
@@ -207,7 +207,7 @@ void ipc_print_links(struct autobuf *abuf) {
     unsigned int diffF = 0;
 
     if (vtime) {
-      unsigned int diff = (unsigned int) (my_link->link_timer->timer_clock - now_times);
+      unsigned int diff = my_link->link_timer ? (unsigned int) (my_link->link_timer->timer_clock - now_times) : 0;
       diffI = diff / 1000;
       diffF = diff % 1000;
     }