[mle] fix invalid router after ProcessRouteTlv (#5200)
We always need to update existing router references after calling
ProcessRouteTlv.
diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp
index 4df5a08..4e70eb2 100644
--- a/src/core/thread/mle_router.cpp
+++ b/src/core/thread/mle_router.cpp
@@ -972,6 +972,9 @@
VerifyOrExit(route.IsValid(), error = OT_ERROR_PARSE);
SuccessOrExit(error = ProcessRouteTlv(route));
UpdateRoutes(route, routerId);
+ // need to update router after ProcessRouteTlv
+ router = mRouterTable.GetRouter(routerId);
+ OT_ASSERT(router != nullptr);
}
// update routing table