You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the generated cluster code (e.g. NetworkCommissioningClient-InvokeSubscribeImpl.cpp), an Optional<Long> is passed as an argument for the breadcrumb attribute for the generated cluster commands (e.g. addOrUpdateWiFiNetwork).
The generated code looks like:
if (breadcrumb != nullptr) {
jobject optionalValue_0;
chip::JniReferences::GetInstance().GetOptionalValue(breadcrumb, optionalValue_0);
auto & definedValue_0 = request.breadcrumb.Emplace();
definedValue_0 = static_cast<std::remove_reference_t<decltype(definedValue_0)>>(chip::JniReferences::GetInstance().LongToPrimitive(optionalValue_0));
}
However, this fails with a JNI error on the call to LongToPrimitive, as the optionalValue_0 (the unwrapped value from the Optional) may be null.
Problem
In the generated cluster code (e.g.
NetworkCommissioningClient-InvokeSubscribeImpl.cpp
), anOptional<Long>
is passed as an argument for thebreadcrumb
attribute for the generated cluster commands (e.g.addOrUpdateWiFiNetwork
).The generated code looks like:
However, this fails with a JNI error on the call to
LongToPrimitive
, as theoptionalValue_0
(the unwrapped value from theOptional
) may be null.The generating code is here:
https://github.com/project-chip/connectedhomeip/blob/master/scripts/idl/generators/java/ChipClustersCpp.jinja
Proposed Solution
The generated code should probably look like:
The text was updated successfully, but these errors were encountered: