Skip to content

Commit

Permalink
Fix LT-20588: Crash in Affix Process Rule (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmaxwell3 authored Sep 25, 2024
1 parent 5dce2e1 commit 21d8819
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Src/LexText/Morphology/AffixRuleFormulaControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private bool DisplayVariableOption(object option)
private bool DisplayColumnOption(object option)
{
SelectionHelper sel = SelectionHelper.Create(m_view);
if (sel.IsRange)
if (sel == null || sel.IsRange)
return false;

int cellId = GetCell(sel);
Expand Down
8 changes: 7 additions & 1 deletion Src/LexText/Morphology/RuleFormulaControl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015 SIL International
// Copyright (c) 2015 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand Down Expand Up @@ -569,6 +569,12 @@ private void m_insertionControl_Insert(object sender, InsertEventArgs e)
var redo = string.Format(MEStrings.ksRuleRedoInsert, option);

SelectionHelper sel = SelectionHelper.Create(m_view);
if (sel == null)
{
// The selection can become invalid because of an undo (see LT-20588).
m_insertionControl.UpdateOptionsDisplay();
return;
}
int cellId = -1;
int cellIndex = -1;
switch (option.Type)
Expand Down

0 comments on commit 21d8819

Please sign in to comment.