From 2bec8b82b355ac78be961b235e620d341a63bdc9 Mon Sep 17 00:00:00 2001
From: Dean Herbert <pe@ppy.sh>
Date: Mon, 5 Sep 2022 16:26:41 +0900
Subject: [PATCH] Fix textbox sample playback potentially crashing if called
 before load

---
 osu.Game/Graphics/UserInterface/OsuTextBox.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
index e5341cfd4b..4c2e00d6e0 100644
--- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
@@ -283,7 +283,7 @@ namespace osu.Game.Graphics.UserInterface
             return samples[RNG.Next(0, samples.Length)]?.GetChannel();
         }
 
-        private void playSample(FeedbackSampleType feedbackSample)
+        private void playSample(FeedbackSampleType feedbackSample) => Schedule(() =>
         {
             if (Time.Current < sampleLastPlaybackTime + 15) return;
 
@@ -300,7 +300,7 @@ namespace osu.Game.Graphics.UserInterface
             channel.Play();
 
             sampleLastPlaybackTime = Time.Current;
-        }
+        });
 
         private class OsuCaret : Caret
         {