Skip to content

Commit

Permalink
Fix JNI error in tv-app (#25331)
Browse files Browse the repository at this point in the history
* Change default passcode returned from account login cluster. Move use of JniUtfString in a code block so that ReleaseStringUTFChars does not happen after DeleteLocalRef.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 5, 2023
1 parent 5576187 commit 4d63308
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private CommandResponseHolder() {
setResponseValue(
Clusters.AccountLogin.Id,
Clusters.AccountLogin.Commands.GetSetupPIN.ID,
"{\"0\":\"12345678\"}");
"{\"0\":\"20202021\"}");
};

public static CommandResponseHolder getInstance() {
Expand Down
10 changes: 6 additions & 4 deletions examples/tv-app/android/java/ContentAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ void ContentAppCommandDelegate::InvokeCommand(CommandHandlerInterface::HandlerCo
env->ExceptionDescribe();
env->ExceptionClear();
FormatResponseData(handlerContext, "{\"value\":{}}");
return;
}
JniUtfString respStr(env, resp);
ChipLogProgress(Zcl, "ContentAppCommandDelegate::InvokeCommand got response %s", respStr.c_str());
FormatResponseData(handlerContext, respStr.c_str());
else
{
JniUtfString respStr(env, resp);
ChipLogProgress(Zcl, "ContentAppCommandDelegate::InvokeCommand got response %s", respStr.c_str());
FormatResponseData(handlerContext, respStr.c_str());
}
env->DeleteLocalRef(resp);
}
else
Expand Down

0 comments on commit 4d63308

Please sign in to comment.