mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 09:40:35 +08:00
px4 subscriber: uorb: check if callback null at correct location
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user