diff --git a/src/DotNext/Buffers/BufferWriterSlim.cs b/src/DotNext/Buffers/BufferWriterSlim.cs index 8443bdddc..30c8950f2 100644 --- a/src/DotNext/Buffers/BufferWriterSlim.cs +++ b/src/DotNext/Buffers/BufferWriterSlim.cs @@ -313,23 +313,24 @@ public MemoryOwner DetachOrCopyBuffer() if (position is 0) { result = default; - goto exit; - } - else if (NoOverflow) - { - result = allocator.AllocateExactly(position); - initialBuffer.CopyTo(result.Span); } else { - result = extraBuffer; - extraBuffer = default; - } + if (NoOverflow) + { + result = allocator.AllocateExactly(position); + initialBuffer.CopyTo(result.Span); + } + else + { + result = extraBuffer; + extraBuffer = default; + } - result.Truncate(position); - position = 0; + result.Truncate(position); + position = 0; + } - exit: return result; }