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 Jul 6, 2023
1 parent e4922d3 commit bdfbfe2
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 bdfbfe2

Please sign in to comment.