[network-diagnostic] avoid reference binding to null pointer (#4401)

This commit is contained in:
Jonathan Hui
2019-12-13 17:20:31 -08:00
committed by GitHub
parent f49d8b7b1d
commit 04bec267e4
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -146,21 +146,21 @@ void NetworkDiagnostic::HandleDiagnosticGetResponse(void * aContex
otError aResult)
{
static_cast<NetworkDiagnostic *>(aContext)->HandleDiagnosticGetResponse(
*static_cast<Coap::Message *>(aMessage), *static_cast<const Ip6::MessageInfo *>(aMessageInfo), aResult);
static_cast<Coap::Message *>(aMessage), static_cast<const Ip6::MessageInfo *>(aMessageInfo), aResult);
}
void NetworkDiagnostic::HandleDiagnosticGetResponse(Coap::Message & aMessage,
const Ip6::MessageInfo &aMessageInfo,
void NetworkDiagnostic::HandleDiagnosticGetResponse(Coap::Message * aMessage,
const Ip6::MessageInfo *aMessageInfo,
otError aResult)
{
VerifyOrExit(aResult == OT_ERROR_NONE);
VerifyOrExit(aMessage.GetCode() == OT_COAP_CODE_CHANGED);
VerifyOrExit(aMessage && aMessage->GetCode() == OT_COAP_CODE_CHANGED);
otLogInfoNetDiag("Received diagnostic get response");
if (mReceiveDiagnosticGetCallback)
{
mReceiveDiagnosticGetCallback(&aMessage, &aMessageInfo, mReceiveDiagnosticGetCallbackContext);
mReceiveDiagnosticGetCallback(aMessage, aMessageInfo, mReceiveDiagnosticGetCallbackContext);
}
exit:
+1 -1
View File
@@ -114,7 +114,7 @@ private:
otMessage * aMessage,
const otMessageInfo *aMessageInfo,
otError aResult);
void HandleDiagnosticGetResponse(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, otError aResult);
void HandleDiagnosticGetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, otError aResult);
static void HandleDiagnosticGetAnswer(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
void HandleDiagnosticGetAnswer(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);