diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index 4e2174b974223d..3584e8f47a5178 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -83,22 +83,31 @@ static void HandleNodeIdResolve(void * context, DnssdService * result, CHIP_ERRO { proxy->OnNodeIdResolutionFailed(PeerId(), error); proxy->Release(); + return; } + VerifyOrDie(proxy != nullptr); + if (result == nullptr) { proxy->OnNodeIdResolutionFailed(PeerId(), CHIP_ERROR_UNKNOWN_RESOURCE_ID); proxy->Release(); + return; } + VerifyOrDie(proxy != nullptr); + PeerId peerId; error = ExtractIdFromInstanceName(result->mName, &peerId); if (CHIP_NO_ERROR != error) { proxy->OnNodeIdResolutionFailed(PeerId(), error); proxy->Release(); + return; } + VerifyOrDie(proxy != nullptr); + ResolvedNodeData nodeData; Platform::CopyString(nodeData.mHostName, result->mHostName); nodeData.mInterfaceId = result->mInterface;