The Free Software Media System - Server Backend & API
Move the check further down
Claus Vium547d0ecf5845
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.csindex 5cd6fd27a6..46593fb2fc 100644--- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs+++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs@@ -24,8 +24,7 @@ namespace MediaBrowser.Controller.MediaEncoding{using (var reader = new StreamReader(source)){- // If ffmpeg process is closed, the state is disposed, so don't write to target in that case- while (!reader.EndOfStream && target.CanWrite)+ while (!reader.EndOfStream){var line = await reader.ReadLineAsync().ConfigureAwait(false);@@ -33,6 +32,12 @@ namespace MediaBrowser.Controller.MediaEncodingvar bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);+ // If ffmpeg process is closed, the state is disposed, so don't write to target in that case+ if (!target.CanWrite)+ {+ break;+ }+await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);await target.FlushAsync().ConfigureAwait(false);}