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
2 people authored and pull[bot] committed Feb 22, 2024
1 parent 377c550 commit 4301000
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 4301000

Please sign in to comment.