fix: Fixes ValueStringBuilder initial rented buffer (#1111)
Fixes issue with ValueStringBuilder having an empty initial buffer.
This commit is contained in:
parent
c6c644c966
commit
8303c74379
2 changed files with 3 additions and 4 deletions
|
|
@ -51,10 +51,9 @@ public ref struct ValueStringBuilder
|
|||
public ValueStringBuilder(int initialCapacity, bool mt = false)
|
||||
{
|
||||
_mt = mt;
|
||||
_arrayToReturnToPool = null;
|
||||
_chars = _arrayToReturnToPool;
|
||||
_length = 0;
|
||||
_arrayToReturnToPool = ArrayPool.Rent(initialCapacity);
|
||||
_arrayToReturnToPool = (_mt ? ArrayPool<char>.Shared : STArrayPool<char>.Shared).Rent(initialCapacity);
|
||||
_chars = _arrayToReturnToPool;
|
||||
}
|
||||
|
||||
public int Length => _length;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 3: // Apply
|
||||
{
|
||||
using var propsBuilder = new ValueStringBuilder(64);
|
||||
using var propsBuilder = ValueStringBuilder.Create();
|
||||
bool first = true;
|
||||
foreach (var attr in MobileAttributes)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue