Skip to content

Commit 5d03fe1

Browse files
Fix LT-22295: Don't crash if MakeDefaultSelection is called early (#484)
1 parent b3bf17a commit 5d03fe1

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Src/LexText/Interlinear/FocusBoxController.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,19 @@ internal bool MakeDefaultSelection(object parameter)
316316
{
317317
if (IsDisposed)
318318
return false; // result is not currently used, not sure what it should be.
319-
InterlinWordControl.MakeDefaultSelection();
319+
if (InterlinWordControl != null)
320+
{
321+
InterlinWordControl.MakeDefaultSelection();
322+
}
323+
else
324+
{
325+
// It wasn't ready yet. Try once more later.
326+
m_mediator.IdleQueue.Add(IdleQueuePriority.Medium, _ =>
327+
{
328+
InterlinWordControl?.MakeDefaultSelection();
329+
return true;
330+
});
331+
}
320332
return true;
321333
}
322334

0 commit comments

Comments
 (0)