From 843b9355a19b7de187530a32e00f0e1fba30a07a Mon Sep 17 00:00:00 2001 From: GreatFireWall Date: Sat, 22 Feb 2020 17:39:18 +0800 Subject: [PATCH] Fix ArgumentNullException issue. --- ICSharpCode.AvalonEdit/Search/SearchPanel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs index 9374428..d8e37c0 100644 --- a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs +++ b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs @@ -272,10 +272,15 @@ namespace ICSharpCode.AvalonEdit.Search { if (searchTextBox == null) return; + var be = searchTextBox.GetBindingExpression(TextBox.TextProperty); + try { - Validation.ClearInvalid(be); + if (be != null) + Validation.ClearInvalid(be); + UpdateSearch(); + } catch (SearchPatternException ex) { var ve = new ValidationError(be.ParentBinding.ValidationRules[0], be, ex.Message, ex); Validation.MarkInvalid(be, ve);