mirror of
https://github.com/espressif/openthread.git
synced 2026-10-03 14:27:38 +00:00
NcpBase: Ensure the sNcpContext is set. (#1038)
This commit fixes issue where `sNcpContext` was NULL and the callbacks to `otNcpStreamWrite()` would cause a crash.
This commit is contained in:
committed by
Jonathan Hui
parent
917fd1d4cc
commit
b11b644418
@@ -462,7 +462,7 @@ NcpBase::NcpBase(otInstance *aInstance):
|
||||
mInstance(aInstance),
|
||||
mLastStatus(SPINEL_STATUS_OK),
|
||||
mSupportedChannelMask(kPhySupportedChannelMask),
|
||||
mChannelMask(mSupportedChannelMask),
|
||||
mChannelMask(kPhySupportedChannelMask),
|
||||
mScanPeriod(200), // ms
|
||||
mUpdateChangedPropsTask(aInstance->mIp6.mTaskletScheduler, &NcpBase::UpdateChangedProps, this),
|
||||
mChangedFlags(NCP_PLAT_RESET_REASON),
|
||||
@@ -488,7 +488,7 @@ NcpBase::NcpBase(otInstance *aInstance):
|
||||
{
|
||||
assert(mInstance != NULL);
|
||||
|
||||
sNcpContext = NULL;
|
||||
sNcpContext = this;
|
||||
|
||||
otSetStateChangedCallback(mInstance, &NcpBase::HandleNetifStateChanged, this);
|
||||
otSetReceiveIp6DatagramCallback(mInstance, &NcpBase::HandleDatagramFromStack, this);
|
||||
|
||||
Reference in New Issue
Block a user