Skip to content

Commit bcc10af

Browse files
committed
CreateEmptyString throws if pool is disposed.
1 parent 3e5231d commit bcc10af

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

UnmanagedStringPool.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,11 @@ internal void FreeString(uint id)
371371
/// Create an empty PooledString in this pool. Requires a pool so we know where to add if insertion occurs
372372
/// </summary>
373373
[MethodImpl(MethodImplOptions.AggressiveInlining)]
374-
internal PooledString CreateEmptyString() => new(this, EmptyStringAllocationId);
374+
internal PooledString CreateEmptyString()
375+
{
376+
ObjectDisposedException.ThrowIf(IsDisposed, typeof(UnmanagedStringPool));
377+
return new(this, EmptyStringAllocationId);
378+
}
375379

376380
#endregion
377381

0 commit comments

Comments
 (0)