We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c39816 commit c5cf7d2Copy full SHA for c5cf7d2
1 file changed
Lagrange.Proto/Primitives/ProtoWriter.cs
@@ -42,7 +42,7 @@ public void EncodeString(ReadOnlySpan<char> str)
42
int min = ProtoHelper.GetVarIntMin(count);
43
int max = ProtoHelper.GetVarIntMax(count);
44
int utf16Max = ProtoConstants.MaxExpansionFactorWhileTranscoding * str.Length;
45
- if (_memory.Length < utf16Max + count) Grow(utf16Max + count);
+ if (_memory.Length - BytesPending < utf16Max + count) Grow(utf16Max + count);
46
47
if (str.Length + count > min && utf16Max + count < max) // falls within the range
48
{
0 commit comments