From 9b7b1bae37899a3f57e920d1858703d72ce7b797 Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Thu, 24 Sep 2015 02:26:45 +0200
Subject: [PATCH] 6lowpan: prefixes are initially all null pointers

Since the prefixes list stores pointers, one need to check for null pointers first.
---
 .../sixlowpan/nd/router/gnrc_sixlowpan_nd_router.c            | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/net/gnrc/network_layer/sixlowpan/nd/router/gnrc_sixlowpan_nd_router.c b/sys/net/gnrc/network_layer/sixlowpan/nd/router/gnrc_sixlowpan_nd_router.c
index c10d4ba493..060863548a 100644
--- a/sys/net/gnrc/network_layer/sixlowpan/nd/router/gnrc_sixlowpan_nd_router.c
+++ b/sys/net/gnrc/network_layer/sixlowpan/nd/router/gnrc_sixlowpan_nd_router.c
@@ -52,7 +52,9 @@ static gnrc_sixlowpan_nd_router_prf_t *_get_free_prefix(ipv6_addr_t *prefix, siz
             return &_prefixes[i];
         }
 
-        if ((prf == NULL) && ipv6_addr_is_unspecified(&_prefixes[i].prefix->addr)) {
+        if ((prf == NULL) &&
+            ((_prefixes[i].prefix == NULL) ||
+             ipv6_addr_is_unspecified(&_prefixes[i].prefix->addr))) {
             prf = &_prefixes[i];
         }
     }
-- 
GitLab