diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 2c4f1eb3540e9f..1dff5e83f666b5 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -171,7 +171,7 @@ bool HandleNullableOptional(Argument & arg, char * argValue, std::function *>(arg.value); - if (strcmp(argValue, "null") == 0) + if (argValue != nullptr && strncmp(argValue, "null", 4) == 0) { nullable->SetNull(); return true;