From d4779f06cf1c2d8eae68d7d63583a3e34c629567 Mon Sep 17 00:00:00 2001 From: Naxesss <30292137+Naxesss@users.noreply.github.com> Date: Tue, 12 Oct 2021 00:30:00 +0200 Subject: [PATCH] Rework `CloseStream` --- osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs b/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs index 602239aac5..f5709b5158 100644 --- a/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs +++ b/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.IO; namespace osu.Game.IO.FileAbstraction @@ -18,9 +19,12 @@ namespace osu.Game.IO.FileAbstraction public Stream ReadStream { get; } public Stream WriteStream => ReadStream; - public void CloseStream(Stream aStream) + public void CloseStream(Stream stream) { - aStream.Position = 0; + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + + stream.Close(); } } }