Skip to content

Commit

Permalink
fix(kvpp): check for an empty string before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Jul 11, 2024
1 parent d81370d commit cc0caa3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/kvpp/kvpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ void KV1Element::readElements(BufferStreamReadOnly& stream, BufferStream& backin
KV1::KV1(std::string_view kv1Data, bool useEscapeSequences_)
: KV1Element()
, useEscapeSequences(useEscapeSequences_) {
if (kv1Data.empty()) {
return;
}
BufferStreamReadOnly stream{kv1Data.data(), kv1Data.size()};

// Multiply by 2 to ensure buffer will have enough space (very generous)
Expand Down

0 comments on commit cc0caa3

Please sign in to comment.