From 1095600264816f4ce6d2c601f3fa0552fd0b5805 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Mon, 8 Nov 2021 18:47:13 +0100 Subject: [PATCH] [CI] Placeholder app segfault after commissioning complete event is received (#11522) --- examples/placeholder/linux/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/placeholder/linux/main.cpp b/examples/placeholder/linux/main.cpp index e0252bb2bc886c..2535f5052c3953 100644 --- a/examples/placeholder/linux/main.cpp +++ b/examples/placeholder/linux/main.cpp @@ -23,28 +23,29 @@ #include "MatterCallbacks.h" -void RunTestCommand() +std::unique_ptr RunTestCommand() { const char * command = LinuxDeviceOptions::GetInstance().command; if (command == nullptr) { - return; + return nullptr; } auto test = GetTestCommand(command); if (test.get() == nullptr) { ChipLogError(chipTool, "Specified test command does not exists: %s", command); - return; + return nullptr; } chip::DeviceLayer::PlatformMgr().AddEventHandler(OnPlatformEvent, reinterpret_cast(test.get())); + return test; } int main(int argc, char * argv[]) { VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); - RunTestCommand(); + auto test = RunTestCommand(); ChipLinuxAppMainLoop(); return 0; }