mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 18:50:07 +00:00
[router-table] exit earlier when GetRouter() for invalid router id (#4485)
This commit is contained in:
@@ -388,7 +388,12 @@ exit:
|
||||
const Router *RouterTable::GetRouter(uint8_t aRouterId) const
|
||||
{
|
||||
const Router *router = NULL;
|
||||
uint16_t rloc16 = Mle::Mle::Rloc16FromRouterId(aRouterId);
|
||||
uint16_t rloc16;
|
||||
|
||||
// Skip if invalid router id is passed.
|
||||
VerifyOrExit(aRouterId < Mle::kInvalidRouterId);
|
||||
|
||||
rloc16 = Mle::Mle::Rloc16FromRouterId(aRouterId);
|
||||
|
||||
for (router = GetFirstEntry(); router != NULL; router = GetNextEntry(router))
|
||||
{
|
||||
@@ -398,6 +403,7 @@ const Router *RouterTable::GetRouter(uint8_t aRouterId) const
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return router;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user