Avoid tsch crash when loosing timesource
@@ -304,6 +304,7 @@ keepalive_send(void *ptr)
{
if(tsch_is_associated) {
struct tsch_neighbor *n = tsch_queue_get_time_source();
+ if(n != NULL) {
/* Simply send an empty packet */
packetbuf_clear();
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &n->addr);
@@ -311,6 +312,9 @@ keepalive_send(void *ptr)
LOG_INFO("sending KA to ");
LOG_INFO_LLADDR(&n->addr);
LOG_INFO_("\n");
+ } else {
+ LOG_INFO("no timesource - KA not sent\n");
+ }
}
}
/*---------------------------------------------------------------------------*/
