misc: chore: Fix possible NullReferenceExceptions, InvalidOperationExceptions

This commit is contained in:
KeatonTheBot 2025-09-30 15:03:01 -05:00
parent fa682d406e
commit 51b32981b6
15 changed files with 70 additions and 49 deletions

View file

@ -316,13 +316,16 @@ namespace ARMeilleure.Translation
{
_root = newNode;
}
else if (start.CompareTo(parent.Start) < 0)
else if (parent != null && start.CompareTo(parent.Start) < 0)
{
parent.Left = newNode;
}
else
{
parent.Right = newNode;
if (parent != null)
{
parent.Right = newNode;
}
}
PropagateIncrease(newNode);