Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
papafe committed Sep 25, 2023
1 parent 7727f37 commit 2fdefc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Realm/Realm/DatabaseTypes/RealmList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public override int IndexOf([AllowNull] T value)
return -1;
}

if (realmValue.Type == RealmValueType.List)
{
return -1;
}

return _listHandle.Find(realmValue);
}

Expand All @@ -146,7 +151,6 @@ public void Insert(int index, T value)
ValidateIndex(index);
var realmValue = ValidateValueToInsert(value);

//TODO Can we do something better than this, so at least we can take out the common?
if (realmValue.Type == RealmValueType.List)
{
var newListHandle = _listHandle.InsertList(index);
Expand Down Expand Up @@ -191,7 +195,7 @@ public override void RemoveAt(int index)
{
ValidateIndex(index);

_listHandle.Erase((IntPtr)index);
_listHandle.Erase(index);
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions Realm/Realm/Handles/ListHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ public int Find(in RealmValue value)
return (int)result;
}

public void Erase(IntPtr rowIndex)
public void Erase(int targetIndex)
{
EnsureIsOpen();

NativeMethods.erase(this, rowIndex, out var nativeException);
NativeMethods.erase(this, (IntPtr)targetIndex, out var nativeException);
nativeException.ThrowIfNecessary();
}

Expand Down

0 comments on commit 2fdefc7

Please sign in to comment.