bug fix: dag pointer may be NULL

This commit is contained in:
fros4943 2010-05-07 13:51:34 +00:00
parent 99b2dd8ef7
commit bc0ea1f81d
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rpl-dag.c,v 1.3 2010/05/04 22:55:32 nvt-se Exp $ * $Id: rpl-dag.c,v 1.4 2010/05/07 13:51:34 fros4943 Exp $
*/ */
/** /**
* \file * \file
@ -618,7 +618,7 @@ rpl_ds6_neighbor_callback(uip_ds6_nbr_t *nbr)
rpl_remove_neighbor(dag, n); rpl_remove_neighbor(dag, n);
} }
} }
if(dag->def_route != NULL && if(dag != NULL && dag->def_route != NULL &&
uip_ipaddr_cmp(&dag->def_route->ipaddr, &n->addr)) { uip_ipaddr_cmp(&dag->def_route->ipaddr, &n->addr)) {
n = rpl_find_best_parent(dag); n = rpl_find_best_parent(dag);
if(n != NULL && dag->of->increment_rank(n->rank, n) <= dag->min_rank + dag->max_rankinc) { if(n != NULL && dag->of->increment_rank(n->rank, n) <= dag->min_rank + dag->max_rankinc) {