From 1b031ca3280d104dadf9543ebf389e2719185b2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Oct 2017 18:28:26 +0900 Subject: [PATCH] Fix potential read from empty queue in SPM counter --- .../Objects/Drawables/Pieces/SpinnerSpmCounter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index c079d3343b..ebe978f659 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (records.Count > 0) { var record = records.Peek(); - while (Time.Current - records.Peek().Time > spm_count_duration) + while (records.Count > 0 && Time.Current - records.Peek().Time > spm_count_duration) record = records.Dequeue(); SpinsPerMinute = (currentRotation - record.Rotation) / (Time.Current - record.Time) * 1000 * 60 / 360; }