diff options
author | Berkan Diler <berkan.diler1@ingka.ikea.com> | 2022-12-27 20:27:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-27 20:27:11 +0100 |
commit | 0d3b82477ecbf7128340b6725a79413427c68748 (patch) | |
tree | 2d62c68e38a3c4c79ef7cc1d92700617a40e70ca /Ryujinx.Memory/MemoryBlock.cs | |
parent | 470be03c2ff22346a1f0ae53fa25f53c4d1790b5 (diff) |
Use new ArgumentNullException and ObjectDisposedException throw-helper API (#4163)1.1.493
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(); } } |