From b421882ed2e8c4277271923152029d8ac886fa1a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 2 Feb 2023 09:46:08 -0500 Subject: [PATCH] Fix crash if chip-tool gets an error status response. (#24799) We are trying to do JSON logging without a delegate in that case. --- examples/chip-tool/commands/common/RemoteDataModelLogger.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp index ccde7acd9781e4..1b397dfe8989d0 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp @@ -144,6 +144,8 @@ CHIP_ERROR LogErrorAsJSON(const chip::app::EventHeader & header, const chip::app CHIP_ERROR LogErrorAsJSON(const CHIP_ERROR & error) { + VerifyOrReturnError(gDelegate != nullptr, CHIP_NO_ERROR); + Json::Value value; chip::app::StatusIB status; status.InitFromChipError(error);