Skip to content

Commit

Permalink
Fix crash when handling jStayActiveMsec
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Oct 9, 2024
1 parent d4c2eaf commit 39b0822
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/controller/java/AndroidDeviceControllerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,13 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyICDRegistrationInfo(chip::Contro
jobject jStayActiveMsec = env->CallObjectMethod(icdRegistrationInfo, getICDStayActiveDurationMsecMethod);
if (jStayActiveMsec != 0)
{
params.SetICDStayActiveDurationMsec(chip::JniReferences::GetInstance().IntegerToPrimitive(jStayActiveMsec));
jlong stayActiveMsec = chip::JniReferences::GetInstance().LongToPrimitive(jStayActiveMsec);
if (!chip::CanCastTo<uint32_t>(stayActiveMsec))
{
ChipLogError(Controller, "Failed to process stayActiveMsec in %s.", __func__);
return CHIP_ERROR_INVALID_ARGUMENT;
}
params.SetICDStayActiveDurationMsec(static_cast<uint32_t>(stayActiveMsec));
}

jmethodID getCheckInNodeIdMethod;
Expand Down

0 comments on commit 39b0822

Please sign in to comment.