From 2b2170c706c746ad097e7f54c45face422c5bbed Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 28 Apr 2022 15:03:28 +0200 Subject: [PATCH] [chip-tool] Do not try to reset an element that does not exists in the case of a group command --- examples/chip-tool/commands/clusters/ClusterCommand.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index ca1738bc8b6715..bea828262d3554 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -104,8 +104,11 @@ class ClusterCommand : public ModelCommand, public chip::app::CommandSender::Cal virtual void OnDone(chip::app::CommandSender * client) override { - mCommandSender.front().reset(); - mCommandSender.erase(mCommandSender.begin()); + if (mCommandSender.size()) + { + mCommandSender.front().reset(); + mCommandSender.erase(mCommandSender.begin()); + } // If the command is repeated N times, wait for all the responses to comes in // before exiting.