Skip to content

Commit

Permalink
Fix tag formatting when enter container fails
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Jul 10, 2023
1 parent cb4d420 commit dc3ac12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/format/protocol_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ bool PayloadDecoderBase::ReaderEnterContainer(PayloadEntry & entry)
if (mCurrentNesting >= kMaxDecodeDepth)
{
mValueBuilder.AddFormat("NESTING DEPTH REACHED");
mReader.GetTag().AppendTo(mNameBuilder.Reset());
entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
return false;
}
Expand All @@ -315,6 +316,7 @@ bool PayloadDecoderBase::ReaderEnterContainer(PayloadEntry & entry)
if (err != CHIP_NO_ERROR)
{
mValueBuilder.AddFormat("ERROR entering container: %" CHIP_ERROR_FORMAT, err.Format());
mReader.GetTag().AppendTo(mNameBuilder.Reset()); // assume enter is not done, so tag is correct
entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
mState = State::kDone;
return false;
Expand Down

0 comments on commit dc3ac12

Please sign in to comment.