From bdfb2bbb8d3655c84dc95702a4948a25e63bc750 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 21 Oct 2016 15:59:34 -1000 Subject: [PATCH] Fixed hardfault on fast proc _baro_topic can be null in init sequence init call collect before the topic is inited. I think this pattern is repeated in other drivers. I would suggest allowing null in orb_publish to just return. --- src/drivers/ms5611/ms5611.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp index 43d10ecf5c..08ac9fab0b 100644 --- a/src/drivers/ms5611/ms5611.cpp +++ b/src/drivers/ms5611/ms5611.cpp @@ -800,7 +800,7 @@ MS5611::collect() report.altitude = (((pow((p / p1), (-(a * R) / g))) * T1) - T1) / a; /* publish it */ - if (!(_pub_blocked)) { + if (!(_pub_blocked) && _baro_topic != nullptr) { /* publish it */ orb_publish(ORB_ID(sensor_baro), _baro_topic, &report); }