@@ -138,14 +138,16 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust
138
138
139
139
std::unique_ptr<Json::CharReader> testReader (readerBuilder.newCharReader ());
140
140
141
- if (!testReader->parse (respStr.c_str (), respStr.c_str () + std::strlen (respStr.c_str ()), &value, &errors)) {
141
+ if (!testReader->parse (respStr.c_str (), respStr.c_str () + std::strlen (respStr.c_str ()), &value, &errors))
142
+ {
142
143
ChipLogError (Zcl, " Failed to parse JSON: %s\n " , errors.c_str ());
143
144
env->DeleteLocalRef (resp);
144
145
return chip::Protocols::InteractionModel::Status::Failure;
145
146
}
146
147
147
148
// Validate and access JSON data safely
148
- if (!value.isObject ()) {
149
+ if (!value.isObject ())
150
+ {
149
151
ChipLogError (Zcl, " Invalid JSON structure: not an object" );
150
152
env->DeleteLocalRef (resp);
151
153
return chip::Protocols::InteractionModel::Status::Failure;
@@ -191,13 +193,15 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand
191
193
Json::Value value;
192
194
std::unique_ptr<Json::CharReader> testReader (readerBuilder.newCharReader ());
193
195
194
- if (!testReader->parse (response, response + std::strlen (response), &value, &errors)) {
196
+ if (!testReader->parse (response, response + std::strlen (response), &value, &errors))
197
+ {
195
198
ChipLogError (Zcl, " Failed to parse JSON: %s\n " , errors.c_str ());
196
199
return ;
197
200
}
198
201
199
202
// Validate and access JSON data safely
200
- if (!value.isObject ()) {
203
+ if (!value.isObject ())
204
+ {
201
205
ChipLogError (Zcl, " Invalid JSON structure: not an object" );
202
206
return ;
203
207
}
0 commit comments