Skip to content

Commit

Permalink
[chip-tool] Allow the string 'null' to be used for TypedComplexArgume…
Browse files Browse the repository at this point in the history
…nt of Nullable type (#23887)
  • Loading branch information
vivien-apple authored Dec 7, 2022
1 parent 203f37e commit ed03e9e
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit ed03e9e

Please sign in to comment.