Skip to content

Commit

Permalink
Fix github issue #14321 - Thread end device (Requestor) crashes if it…
Browse files Browse the repository at this point in the history
… cannot reach the Provider (#14712)

* Fix github issue #14321

* Updates from PR suggestions

* Restyled by whitespace

* Restyled by clang-format

* Add verify or die calls to Discovery_ImplPlatform.cpp

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
mykrupp and restyled-commits authored Feb 7, 2022
1 parent 56be65c commit c7f7244
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/dnssd/Discovery_ImplPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7f7244

Please sign in to comment.