From b11b644418dbddcd9d3cea5e0569e6dfca7a30d6 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 2 Dec 2016 15:58:41 -0800 Subject: [PATCH] NcpBase: Ensure the `sNcpContext` is set. (#1038) This commit fixes issue where `sNcpContext` was NULL and the callbacks to `otNcpStreamWrite()` would cause a crash. --- src/ncp/ncp_base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 38808eb9b..42077a517 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -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);