Skip to content

Commit

Permalink
Uavcan:Fix null pointer defrefenence
Browse files Browse the repository at this point in the history
  • Loading branch information
davids5 authored and LorenzMeier committed Feb 29, 2020
1 parent 993755b commit 64cf310
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/drivers/uavcan/uavcan_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,15 @@ UavcanNode::print_info()
printf("CAN%u status:\n", unsigned(i + 1));

auto iface = _node.getDispatcher().getCanIOManager().getCanDriver().getIface(i);
printf("\tHW errors: %llu\n", iface->getErrorCount());

auto iface_perf_cnt = _node.getDispatcher().getCanIOManager().getIfacePerfCounters(i);
printf("\tIO errors: %llu\n", iface_perf_cnt.errors);
printf("\tRX frames: %llu\n", iface_perf_cnt.frames_rx);
printf("\tTX frames: %llu\n", iface_perf_cnt.frames_tx);
if (iface) {
printf("\tHW errors: %llu\n", iface->getErrorCount());

auto iface_perf_cnt = _node.getDispatcher().getCanIOManager().getIfacePerfCounters(i);
printf("\tIO errors: %llu\n", iface_perf_cnt.errors);
printf("\tRX frames: %llu\n", iface_perf_cnt.frames_rx);
printf("\tTX frames: %llu\n", iface_perf_cnt.frames_tx);
}
}

printf("\n");
Expand Down

0 comments on commit 64cf310

Please sign in to comment.