Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Src/LexText/Interlinear/FocusBoxController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,19 @@ internal bool MakeDefaultSelection(object parameter)
{
if (IsDisposed)
return false; // result is not currently used, not sure what it should be.
InterlinWordControl.MakeDefaultSelection();
if (InterlinWordControl != null)
{
InterlinWordControl.MakeDefaultSelection();
}
else
{
// It wasn't ready yet. Try once more later.
m_mediator.IdleQueue.Add(IdleQueuePriority.Medium, _ =>
{
InterlinWordControl?.MakeDefaultSelection();
return true;
Comment on lines +328 to +329
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda function always returns true regardless of whether MakeDefaultSelection() was actually called. Consider returning a meaningful value that indicates whether the operation was successful, or add error handling if the InterlinWordControl is still null when the deferred operation executes.

Suggested change
InterlinWordControl?.MakeDefaultSelection();
return true;
if (InterlinWordControl != null)
{
InterlinWordControl.MakeDefaultSelection();
return true;
}
else
{
// Optionally log or handle the error here.
// System.Diagnostics.Debug.WriteLine("InterlinWordControl is still null in deferred MakeDefaultSelection.");
return false;
}

Copilot uses AI. Check for mistakes.

});
}
return true;
}

Expand Down
Loading