diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 7a0df26a2..7c10da011 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -334,8 +334,7 @@ void Mle::SetRole(otDeviceRole aRole) } #if OPENTHREAD_ENABLE_BORDER_AGENT - // Start border agent - if (aRole == OT_DEVICE_ROLE_ROUTER || aRole == OT_DEVICE_ROLE_LEADER || aRole == OT_DEVICE_ROLE_CHILD) + if (IsAttached()) { SuccessOrExit(GetInstance().Get().Start()); }