Skip to content

Commit 941c1d2

Browse files
vivien-applebzbarsky-appleandy31415
authored
[AddressResolver] Add a check in shutdown to avoid some crashes if so… (project-chip#35824)
* [AddressResolver] Add a check in shutdown to avoid some crashes if someone calls it multiple times * Apply suggestion from code review. Co-authored-by: Andrei Litvin <andy314@gmail.com> --------- Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Andrei Litvin <andy314@gmail.com>
1 parent 0a0e9ce commit 941c1d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/address_resolve/AddressResolve_DefaultImpl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ CHIP_ERROR Resolver::Init(System::Layer * systemLayer)
248248

249249
void Resolver::Shutdown()
250250
{
251+
// mSystemLayer is set in ::Init, so if it's null that means the resolver
252+
// has not been initialized or has already been shut down.
253+
VerifyOrReturn(mSystemLayer != nullptr);
254+
251255
while (mActiveLookups.begin() != mActiveLookups.end())
252256
{
253257
auto current = mActiveLookups.begin();

0 commit comments

Comments
 (0)