From 44551d43ae74289bc73975bd1e2a64ae21cb3d76 Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Sat, 1 May 2021 22:18:15 +0200
Subject: [PATCH] fix: use SafeMemory for Util.DumpMemory
---
Dalamud/Util.cs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/Dalamud/Util.cs b/Dalamud/Util.cs
index 5afec37c2..e9a269db0 100644
--- a/Dalamud/Util.cs
+++ b/Dalamud/Util.cs
@@ -50,9 +50,15 @@ namespace Dalamud
/// The length to read.
public static void DumpMemory(IntPtr offset, int len = 512)
{
- var data = new byte[len];
- Marshal.Copy(offset, data, 0, len);
- Log.Information(ByteArrayToHex(data));
+ try
+ {
+ SafeMemory.ReadBytes(offset, len, out var data);
+ Log.Information(ByteArrayToHex(data));
+ }
+ catch (Exception ex)
+ {
+ Log.Error(ex, "Read failed");
+ }
}
///