Skip to content

Commit

Permalink
Fix array vs vector conversion in chef (#28369)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Mar 20, 2024
1 parent 2a15ff5 commit bf8264c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/chef/common/chef-channel-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ void ChefChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannel
{
matchedChannels[totalMatchedChannels++] = (channel);
}
else if (matchedChannels.size() == 0)
else if (totalMatchedChannels == 0)
{
// "index" is only used when we end up with matchedChannels.size() == 1.
// "index" is only used when we end up with totalMatchedChannels == 1.
// In that case, we want it to be the number of non-matching channels we saw before
// the matching one.
index++;
Expand All @@ -146,12 +146,12 @@ void ChefChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannel
ChangeChannelResponseType response;

// Error: Found multiple matches
if (matchedChannels.size() > 1)
if (totalMatchedChannels > 1)
{
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kMultipleMatches;
helper.Success(response);
}
else if (matchedChannels.size() == 0)
else if (totalMatchedChannels == 0)
{
// Error: Found no match
response.status = chip::app::Clusters::Channel::ChannelStatusEnum::kNoMatches;
Expand Down

0 comments on commit bf8264c

Please sign in to comment.