Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chip-tool] Allow the string 'null' to be used for TypedComplexArgume… #23887

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/chip-tool/commands/clusters/ComplexArgument.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

#include "JsonParser.h"

constexpr uint8_t kMaxLabelLength = 100;
constexpr uint8_t kMaxLabelLength = 100;
constexpr const char kNullString[] = "null";

class ComplexArgumentParser
{
Expand Down Expand Up @@ -326,7 +327,11 @@ class TypedComplexArgument : public ComplexArgument
CHIP_ERROR Parse(const char * label, const char * json)
{
Json::Value value;
if (!JsonParser::ParseComplexArgument(label, json, value))
if (strcmp(kNullString, json) == 0)
{
value = Json::nullValue;
}
else if (!JsonParser::ParseComplexArgument(label, json, value))
{
return CHIP_ERROR_INVALID_ARGUMENT;
}
Expand Down