aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Nifm
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Nifm')
-rw-r--r--Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs
index 3f4df719..9b501d7c 100644
--- a/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs
+++ b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs
@@ -1,6 +1,7 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
+using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Nifm
@@ -48,8 +49,15 @@ namespace Ryujinx.HLE.HOS.Services.Nifm
public long GetSystemEventReadableHandles(ServiceCtx Context)
{
- int Handle0 = Context.Process.HandleTable.OpenHandle(Event0);
- int Handle1 = Context.Process.HandleTable.OpenHandle(Event1);
+ if (Context.Process.HandleTable.GenerateHandle(Event0.ReadableEvent, out int Handle0) != KernelResult.Success)
+ {
+ throw new InvalidOperationException("Out of handles!");
+ }
+
+ if (Context.Process.HandleTable.GenerateHandle(Event1.ReadableEvent, out int Handle1) != KernelResult.Success)
+ {
+ throw new InvalidOperationException("Out of handles!");
+ }
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle0, Handle1);