Skip to content

Commit

Permalink
Proper null handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Feb 12, 2024
1 parent 0ed99e5 commit 58a35d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions YDotNet/Document/Transactions/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ private nint GetWithKind(string name, BranchKind expectedKind)
}

var branchKind = (BranchKind)BranchChannel.Kind(branchHandle);

if (branchKind == BranchKind.Null)
{
return nint.Zero;
}

if (branchKind != expectedKind)
{
throw new YDotNetException($"Expected '{expectedKind}', got '{branchKind}'.");
Expand Down
1 change: 1 addition & 0 deletions YDotNet/Native/Types/Branches/BranchKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace YDotNet.Native.Types.Branches;

internal enum BranchKind
{
Null = 0,
Array = 1,
Map = 2,
Text = 3,
Expand Down

0 comments on commit 58a35d3

Please sign in to comment.