diff options
Diffstat (limited to 'Ryujinx.Memory/MemoryBlock.cs')
-rw-r--r-- | Ryujinx.Memory/MemoryBlock.cs | 11 |
1 files changed, 2 insertions, 9 deletions
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<T>(); @@ -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(); } } |