Browse Source

Check for TextBox.Text null in AutoCompleteBox

pull/6429/head
Wiesław Šoltés 5 years ago
parent
commit
08dea6498e
  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
// was causing an immediate update, even with wrapping. If there is
// 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;
}
@ -2303,7 +2303,7 @@ namespace Avalonia.Controls
{
if (IsTextCompletionEnabled && TextBox != null && userInitiated)
{
int currentLength = TextBox.Text.Length;
int currentLength = TextBox.Text?.Length ?? 0;
int selectionStart = TextBoxSelectionStart;
if (selectionStart == text.Length && selectionStart > _textSelectionStart)
{

Loading…
Cancel
Save