Skip to content

Commit

Permalink
Fix Crash when wildcard subscribe (#25676)
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo authored and pull[bot] committed Sep 11, 2023
1 parent 3501019 commit 1018798
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,11 @@ JNI_METHOD(void, subscribe)
params.mIsFabricFiltered = (isFabricFiltered != JNI_FALSE);
params.mTimeout = imTimeoutMs != 0 ? System::Clock::Milliseconds32(imTimeoutMs) : System::Clock::kZero;

SuccessOrExit(err = JniReferences::GetInstance().GetListSize(attributePathList, numAttributePaths));
if (attributePathList != nullptr)
{
SuccessOrExit(err = JniReferences::GetInstance().GetListSize(attributePathList, numAttributePaths));
}

if (numAttributePaths > 0)
{
std::unique_ptr<chip::app::AttributePathParams[]> attributePaths(new chip::app::AttributePathParams[numAttributePaths]);
Expand All @@ -1398,7 +1402,11 @@ JNI_METHOD(void, subscribe)
attributePaths.release();
}

SuccessOrExit(err = JniReferences::GetInstance().GetListSize(eventPathList, numEventPaths));
if (eventPathList != nullptr)
{
SuccessOrExit(err = JniReferences::GetInstance().GetListSize(eventPathList, numEventPaths));
}

if (numEventPaths > 0)
{
std::unique_ptr<chip::app::EventPathParams[]> eventPaths(new chip::app::EventPathParams[numEventPaths]);
Expand Down

0 comments on commit 1018798

Please sign in to comment.