Fix null-reference exception in TextAreaAutomationPeer - that was randomly occuring in the application.

This commit is contained in:
Alexander Sloutsky 2020-06-06 13:49:20 +03:00
Родитель f1e5677146
Коммит 09f7dec79b
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -114,8 +114,11 @@ namespace ICSharpCode.AvalonEdit.Editing
return this;
if (patternInterface == PatternInterface.Scroll) {
TextEditor editor = TextArea.GetService(typeof(TextEditor)) as TextEditor;
if (editor != null)
return FromElement(editor).GetPattern(patternInterface);
if (editor != null) {
var fromElement = FromElement(editor);
if (fromElement != null)
fromElement.GetPattern(patternInterface);
}
}
return base.GetPattern(patternInterface);
}