Skip to content
This repository was archived by the owner on Feb 19, 2021. It is now read-only.

Commit eed3796

Browse files
author
Sammy Sammon
committed
Fixed crash on pause
1 parent 1c2a751 commit eed3796

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ReadFullyStream.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public override long Position
5757
throw new InvalidOperationException();
5858
}
5959
}
60-
61-
60+
6261
public override int Read(byte[] buffer, int offset, int count)
6362
{
6463
int bytesRead = 0;
@@ -76,7 +75,14 @@ public override int Read(byte[] buffer, int offset, int count)
7675
else
7776
{
7877
readAheadOffset = 0;
79-
readAheadLength = sourceStream.Read(readAheadBuffer, 0, readAheadBuffer.Length);
78+
try
79+
{
80+
readAheadLength = sourceStream.Read(readAheadBuffer, 0, readAheadBuffer.Length);
81+
}
82+
catch (Exception e)
83+
{
84+
//Read will throw an exception when pausing due to the thread dying, so we just ignore it.
85+
}
8086
//Debug.WriteLine(String.Format("Read {0} bytes (requested {1})", readAheadLength, readAheadBuffer.Length));
8187
if (readAheadLength == 0)
8288
{

0 commit comments

Comments
 (0)