From 71fafcac857752de8408b1059f401f1662d588a7 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Mon, 13 May 2024 20:15:23 -0700 Subject: [PATCH] Propagate errors through NxFileStream --- src/LibHac/Tools/FsSystem/NxFileStream.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LibHac/Tools/FsSystem/NxFileStream.cs b/src/LibHac/Tools/FsSystem/NxFileStream.cs index 306f0e34..664baae4 100644 --- a/src/LibHac/Tools/FsSystem/NxFileStream.cs +++ b/src/LibHac/Tools/FsSystem/NxFileStream.cs @@ -25,7 +25,7 @@ public class NxFileStream : Stream public override int Read(byte[] buffer, int offset, int count) { - BaseFile.Read(out long bytesRead, Position, buffer.AsSpan(offset, count)); + BaseFile.Read(out long bytesRead, Position, buffer.AsSpan(offset, count)).ThrowIfFailure(); Position += bytesRead; return (int)bytesRead; @@ -33,14 +33,14 @@ public class NxFileStream : Stream public override void Write(byte[] buffer, int offset, int count) { - BaseFile.Write(Position, buffer.AsSpan(offset, count)); + BaseFile.Write(Position, buffer.AsSpan(offset, count)).ThrowIfFailure(); Position += count; } public override void Flush() { - BaseFile.Flush(); + BaseFile.Flush().ThrowIfFailure(); } public override long Seek(long offset, SeekOrigin origin)