diff --git a/Ryujinx.Horizon.Common/Result.cs b/Ryujinx.Horizon.Common/Result.cs index 04281199..ac843688 100644 --- a/Ryujinx.Horizon.Common/Result.cs +++ b/Ryujinx.Horizon.Common/Result.cs @@ -100,6 +100,14 @@ namespace Ryujinx.Horizon.Common } } + public void AbortOnFailureUnless(Result result, Result result2) + { + if (this != Success && this != result && this != result2) + { + ThrowInvalidResult(); + } + } + private void ThrowInvalidResult() { throw new InvalidResultException(this); @@ -115,4 +123,4 @@ namespace Ryujinx.Horizon.Common return PrintableResult; } } -} +} \ No newline at end of file diff --git a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs index deac524c..822a4b4a 100644 --- a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs +++ b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs @@ -51,7 +51,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { Result result = ReplyImpl(sessionHandle, messageBuffer); - result.AbortUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); + result.AbortOnFailureUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); return Result.Success; } @@ -86,4 +86,4 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc return result; } } -} +} \ No newline at end of file