diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-10 17:02:49 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-10 17:02:49 +0100 |
commit | f0ad2c9ef55dc2508e777384f8d0496042ade9e8 (patch) | |
tree | f1213464b192af2cfdceb0da6cc48f2c73034ff3 /src | |
parent | da4cfad3c2dc14f17ccf0e9a8ce41309b76964e4 (diff) | |
download | px4-firmware-f0ad2c9ef55dc2508e777384f8d0496042ade9e8.tar.gz px4-firmware-f0ad2c9ef55dc2508e777384f8d0496042ade9e8.tar.bz2 px4-firmware-f0ad2c9ef55dc2508e777384f8d0496042ade9e8.zip |
px4 subscriber: uorb: check if callback null at correct location
Diffstat (limited to 'src')
-rw-r--r-- | src/platforms/px4_subscriber.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 5d0120f90..45cb650b2 100644 --- a/src/platforms/px4_subscriber.h +++ b/src/platforms/px4_subscriber.h @@ -115,10 +115,6 @@ public: */ void update() { - if (_callback == nullptr) { - return; - } - if (!uORB::Subscription<M>::updated()) { /* Topic not updated, do not call callback */ return; @@ -127,6 +123,12 @@ public: /* get latest data */ uORB::Subscription<M>::update(); + + /* Check if there is a callback */ + if (_callback == nullptr) { + return; + } + /* Call callback which performs actions based on this data */ _callback(uORB::Subscription<M>::getData()); |