Fixes ReadOnlyNativePtrArray.IndexOf returning invalid index.

This commit is contained in:
Deukhoofd committed 2021-03-13 14:43:17 +01:00
1 parent 3a7edb2fc3
commit ced4524737
3 files changed
+6 -6

No files matched your search

Binary file not shown.
Binary file not shown.
@@ -62,10 +62,10 @@ namespace PkmnLibSharp.Utilities
{
for (var i = 0; i < Count; i++)
{
var p = _ptr + (i * IntPtr.Size);
if (item == null)
var p = GetPtr(i);
if (item == null && p == IntPtr.Zero)
return i;
if (p == item.Ptr)
if (p == item?.Ptr)
return i;
}
return -1;