mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 14:03:34 +08:00
uORB: fix off-by-one bug in topic count
This commit is contained in:
@@ -308,11 +308,13 @@ int orb_exists(const struct orb_metadata *meta, int instance)
|
|||||||
*/
|
*/
|
||||||
int orb_group_count(const struct orb_metadata *meta)
|
int orb_group_count(const struct orb_metadata *meta)
|
||||||
{
|
{
|
||||||
unsigned group_count = 0;
|
unsigned instance = 0;
|
||||||
|
|
||||||
while (!uORB::Manager::get_instance()->orb_exists(meta, group_count++)) {};
|
while (uORB::Manager::get_instance()->orb_exists(meta, instance) == OK) {
|
||||||
|
++instance;
|
||||||
|
};
|
||||||
|
|
||||||
return group_count;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user