Skip to content

Commit 09f7dec

Browse files
committed
Fix null-reference exception in TextAreaAutomationPeer - that was randomly occuring in the application.
1 parent f1e5677 commit 09f7dec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ICSharpCode.AvalonEdit/Editing/TextAreaAutomationPeer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ public override object GetPattern(PatternInterface patternInterface)
114114
return this;
115115
if (patternInterface == PatternInterface.Scroll) {
116116
TextEditor editor = TextArea.GetService(typeof(TextEditor)) as TextEditor;
117-
if (editor != null)
118-
return FromElement(editor).GetPattern(patternInterface);
117+
if (editor != null) {
118+
var fromElement = FromElement(editor);
119+
if (fromElement != null)
120+
fromElement.GetPattern(patternInterface);
121+
}
119122
}
120123
return base.GetPattern(patternInterface);
121124
}

0 commit comments

Comments
 (0)