1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge pull request #20142 from peppy/fix-textbox-potential-crash

Fix textbox sample playback potentially crashing if called before load
This commit is contained in:
Dan Balasescu 2022-09-05 17:05:28 +09:00 committed by GitHub
commit 764bb7a8e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
{