Skip to content

Conversation

jasonleenaylor
Copy link
Contributor

@jasonleenaylor jasonleenaylor commented Oct 7, 2025

This change is Reviewable

@Copilot Copilot AI review requested due to automatic review settings October 7, 2025 16:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes a crash in the FocusBoxController when MakeDefaultSelection is called before InterlinWordControl is initialized. The fix adds null checking and defers the operation to the idle queue if the control is not ready yet.

  • Added null checking for InterlinWordControl before calling MakeDefaultSelection
  • Implemented deferred execution using the idle queue when the control is not yet available
  • Used null-conditional operator for safety in the deferred callback

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +328 to +329
InterlinWordControl?.MakeDefaultSelection();
return true;
Copy link
Preview

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.

Copy link
Contributor

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

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

@mark-sil reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jasonleenaylor)

Copy link
Contributor

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jasonleenaylor)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants