Browse Source

Merge pull request #6429 from wieslawsoltes/AutoCompleteBoxNullReferenceFix

Check if TextBox.Text is null in AutoCompleteBox
release/0.10.7
Max Katz 5 years ago
committed by Dan Walmsley
parent
commit
031f1b8cd4
  1. 4
      src/Avalonia.Controls/AutoCompleteBox.cs

4
src/Avalonia.Controls/AutoCompleteBox.cs

@ -2005,7 +2005,7 @@ namespace Avalonia.Controls
// The TextBox.TextChanged event was not firing immediately and // The TextBox.TextChanged event was not firing immediately and
// was causing an immediate update, even with wrapping. If there is // was causing an immediate update, even with wrapping. If there is
// a selection currently, no update should happen. // a selection currently, no update should happen.
if (IsTextCompletionEnabled && TextBox != null && TextBoxSelectionLength > 0 && TextBoxSelectionStart != TextBox.Text.Length) if (IsTextCompletionEnabled && TextBox != null && TextBoxSelectionLength > 0 && TextBoxSelectionStart != (TextBox.Text?.Length ?? 0))
{ {
return; return;
} }
@ -2303,7 +2303,7 @@ namespace Avalonia.Controls
{ {
if (IsTextCompletionEnabled && TextBox != null && userInitiated) if (IsTextCompletionEnabled && TextBox != null && userInitiated)
{ {
int currentLength = TextBox.Text.Length; int currentLength = TextBox.Text?.Length ?? 0;
int selectionStart = TextBoxSelectionStart; int selectionStart = TextBoxSelectionStart;
if (selectionStart == text.Length && selectionStart > _textSelectionStart) if (selectionStart == text.Length && selectionStart > _textSelectionStart)
{ {

Loading…
Cancel
Save