-
-
Notifications
You must be signed in to change notification settings - Fork 38
Fix LT-22295: Don't crash if MakeDefaultSelection is called early #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/9.3
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
InterlinWordControl?.MakeDefaultSelection(); | ||
return true; |
There was a problem hiding this comment.
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.
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.
There was a problem hiding this 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)
There was a problem hiding this 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)
This change is