From 5477046089a7ca01b6907d19a14b9cc7193b726b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 1 Feb 2023 15:00:18 -0500 Subject: [PATCH] Fix crash if chip-tool gets an error status response. 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);