px4 subscriber: uorb: check if callback null at correct location

This commit is contained in:
Thomas Gubler 2014-12-10 17:02:49 +01:00
parent da4cfad3c2
commit f0ad2c9ef5
1 changed files with 6 additions and 4 deletions

View File

@ -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());