I was checking out my code on a practice dummy and it had Aura 7056 on it which returned a IntPtr.Zero value into lpRow.
I added a check before doing the ClientDB unpack for valid lpRow
Code:
public static void GetLocalizedRow(IntPtr clientDb, int recordId, out IntPtr buffer)
{
clientDb = (IntPtr) (clientDb.ToInt32() - 0x18);
var header = Memory.ReadStruct<WoWDb.WoWClientDb>(clientDb);
buffer = IntPtr.Zero;
if (recordId >= header.MinIndex && recordId <= header.MaxIndex)
{
var lpRow = Memory.Read<IntPtr>((IntPtr) (header.Rows.ToInt32() + (4 * (recordId - header.MinIndex))));
if(lpRow != IntPtr.Zero)
{
if (Memory.Read<byte>((IntPtr) WOW_USE_SPELL_UNPACK) == 1)
{
ClientDbUnpack(lpRow, 0x2C0u, out buffer);
}
else
{
byte[] data = Memory.ReadBytes(lpRow, 0x2C0);
buffer = Marshal.AllocHGlobal(0x2C0);
Marshal.Copy(data, 0, buffer, 0x2C0);
}
}
}
}