We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44fed18 commit 8359d44Copy full SHA for 8359d44
MLAPI/Serialization/Pooled/BitStreamPool.cs
@@ -22,8 +22,11 @@ public static PooledBitStream GetStream()
22
if (overflowStreams.Count > 0)
23
{
24
if (LogHelper.CurrentLogLevel <= LogLevel.Developer) LogHelper.LogInfo("Retrieving PooledBitStream from overflow pool. Recent burst?");
25
- WeakReference weakStream;
26
- while (!(weakStream = overflowStreams.Dequeue()).IsAlive) ;
+
+ WeakReference weakStream = null;
27
28
+ while (overflowStreams.Count > 0 && ((weakStream = overflowStreams.Dequeue()) == null || !weakStream.IsAlive)) ;
29
30
if (weakStream.IsAlive) return (PooledBitStream)weakStream.Target;
31
}
32
0 commit comments