From 0d3b82477ecbf7128340b6725a79413427c68748 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Tue, 27 Dec 2022 20:27:11 +0100 Subject: Use new ArgumentNullException and ObjectDisposedException throw-helper API (#4163) --- Ryujinx.Memory/MemoryBlock.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'Ryujinx.Memory/MemoryBlock.cs') diff --git a/Ryujinx.Memory/MemoryBlock.cs b/Ryujinx.Memory/MemoryBlock.cs index 79a5cfe7..41e6224b 100644 --- a/Ryujinx.Memory/MemoryBlock.cs +++ b/Ryujinx.Memory/MemoryBlock.cs @@ -279,10 +279,7 @@ namespace Ryujinx.Memory { IntPtr ptr = _pointer; - if (ptr == IntPtr.Zero) - { - ThrowObjectDisposed(); - } + ObjectDisposedException.ThrowIf(ptr == IntPtr.Zero, this); int size = Unsafe.SizeOf(); @@ -312,10 +309,7 @@ namespace Ryujinx.Memory { IntPtr ptr = _pointer; - if (ptr == IntPtr.Zero) - { - ThrowObjectDisposed(); - } + ObjectDisposedException.ThrowIf(ptr == IntPtr.Zero, this); ulong endOffset = offset + size; @@ -454,7 +448,6 @@ namespace Ryujinx.Memory return true; } - private static void ThrowObjectDisposed() => throw new ObjectDisposedException(nameof(MemoryBlock)); private static void ThrowInvalidMemoryRegionException() => throw new InvalidMemoryRegionException(); } } -- cgit v1.2.3