[mle] use IsAttached() to start border agent (#3554)

This commit is contained in:
Abtin Keshavarzian
2019-02-04 21:08:11 -08:00
committed by Jonathan Hui
parent ab871b5025
commit ede320712e
+1 -2
View File
@@ -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<MeshCoP::BorderAgent>().Start());
}