Fixes ReadOnlyNativePtrArray.IndexOf returning invalid index.

This commit is contained in:
Deukhoofd 2021-03-13 14:43:17 +01:00
parent 3a7edb2fc3
commit ced4524737
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 6 additions and 6 deletions

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

View File

@ -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;