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 <andreilitvin@google.com>
  • Loading branch information
andy31415 and andreilitvin committed Jul 28, 2023
1 parent a406232 commit 2f32d3b
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 2f32d3b

Please sign in to comment.