Skip to content

Commit

Permalink
Merge pull request #6293 from smoogipoo/fix-incorrect-assert
Browse files Browse the repository at this point in the history
Fix incorrect assertion and possible nullref
  • Loading branch information
peppy authored May 21, 2024
2 parents fdb335b + a6d5fb7 commit d48e771
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions osu.Framework/Graphics/UserInterface/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,20 +1377,21 @@ private void bindInput([CanBeNull] TextBox previous)

private void unbindInput([CanBeNull] TextBox next)
{
Debug.Assert(textInput != null);

if (!textInputBound)
return;

textInputBound = false;

// see the comment above, in `bindInput(bool)`.
if (next?.textInput != textInput)
textInput.Deactivate();
if (textInput != null)
{
// see the comment above, in `bindInput(bool)`.
if (next?.textInput != textInput)
textInput.Deactivate();

textInput.OnTextInput -= handleTextInput;
textInput.OnImeComposition -= handleImeComposition;
textInput.OnImeResult -= handleImeResult;
textInput.OnTextInput -= handleTextInput;
textInput.OnImeComposition -= handleImeComposition;
textInput.OnImeResult -= handleImeResult;
}

// in case keys are held and we lose focus, we should no longer block key events
textInputBlocking = false;
Expand Down

0 comments on commit d48e771

Please sign in to comment.