diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 5d0120f90e..45cb650b24 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::updated()) { /* Topic not updated, do not call callback */ return; @@ -127,6 +123,12 @@ public: /* get latest data */ uORB::Subscription::update(); + + /* Check if there is a callback */ + if (_callback == nullptr) { + return; + } + /* Call callback which performs actions based on this data */ _callback(uORB::Subscription::getData());