1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 23:03:21 +08:00

Fix textbox sample playback potentially crashing if called before load

This commit is contained in:
Dean Herbert 2022-09-05 16:26:41 +09:00
parent 07d4a025b0
commit 2bec8b82b3

View File

@ -283,7 +283,7 @@ namespace osu.Game.Graphics.UserInterface
return samples[RNG.Next(0, samples.Length)]?.GetChannel(); 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; if (Time.Current < sampleLastPlaybackTime + 15) return;
@ -300,7 +300,7 @@ namespace osu.Game.Graphics.UserInterface
channel.Play(); channel.Play();
sampleLastPlaybackTime = Time.Current; sampleLastPlaybackTime = Time.Current;
} });
private class OsuCaret : Caret private class OsuCaret : Caret
{ {