Merge pull request #1639 from yatch/pr-tsch-log-link-null

Handle the case when log->link is NULL in tsch_log_process_pending
This commit is contained in:
Simon Duquennoy 2016-04-28 18:12:34 +02:00
commit 1cd06a291e

View file

@ -84,11 +84,15 @@ tsch_log_process_pending(void)
} }
while((log_index = ringbufindex_peek_get(&log_ringbuf)) != -1) { while((log_index = ringbufindex_peek_get(&log_ringbuf)) != -1) {
struct tsch_log_t *log = &log_array[log_index]; struct tsch_log_t *log = &log_array[log_index];
struct tsch_slotframe *sf = tsch_schedule_get_slotframe_by_handle(log->link->slotframe_handle); if(log->link == NULL) {
printf("TSCH: {asn-%x.%lx link-%u-%u-%u-%u ch-%u} ", printf("TSCH: {asn-%x.%lx link-NULL} ", log->asn.ms1b, log->asn.ls4b);
log->asn.ms1b, log->asn.ls4b, } else {
log->link->slotframe_handle, sf ? sf->size.val : 0, log->link->timeslot, log->link->channel_offset, struct tsch_slotframe *sf = tsch_schedule_get_slotframe_by_handle(log->link->slotframe_handle);
tsch_calculate_channel(&log->asn, log->link->channel_offset)); printf("TSCH: {asn-%x.%lx link-%u-%u-%u-%u ch-%u} ",
log->asn.ms1b, log->asn.ls4b,
log->link->slotframe_handle, sf ? sf->size.val : 0, log->link->timeslot, log->link->channel_offset,
tsch_calculate_channel(&log->asn, log->link->channel_offset));
}
switch(log->type) { switch(log->type) {
case tsch_log_tx: case tsch_log_tx:
printf("%s-%u-%u %u tx %d, st %d-%d", printf("%s-%u-%u %u tx %d, st %d-%d",