mirror of
https://github.com/ppy/osu
synced 2025-02-17 10:57:03 +00:00
Fix replay handler nullref crashes
This commit is contained in:
parent
6738bd54c0
commit
5d91c3bcfc
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool IsImportant(OsuReplayFrame frame) => frame?.Actions.Any() ?? false;
|
protected override bool IsImportant(OsuReplayFrame frame) => frame.Actions.Any();
|
||||||
|
|
||||||
protected Vector2? Position
|
protected Vector2? Position
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Input.StateChanges;
|
using osu.Framework.Input.StateChanges;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
@ -87,14 +88,24 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
|
|
||||||
protected bool HasFrames => Frames.Count > 0;
|
protected bool HasFrames => Frames.Count > 0;
|
||||||
|
|
||||||
private bool inImportantSection =>
|
private bool inImportantSection
|
||||||
HasFrames && FrameAccuratePlayback &&
|
{
|
||||||
//a button is in a pressed state
|
get
|
||||||
IsImportant(currentDirection > 0 ? CurrentFrame : NextFrame) &&
|
{
|
||||||
//the next frame is within an allowable time span
|
if (!HasFrames || !FrameAccuratePlayback)
|
||||||
Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan;
|
return false;
|
||||||
|
|
||||||
protected virtual bool IsImportant(TFrame frame) => false;
|
var checkFrame = currentDirection > 0 ? CurrentFrame : NextFrame;
|
||||||
|
|
||||||
|
if (checkFrame == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return IsImportant(currentDirection > 0 ? CurrentFrame : NextFrame) && //a button is in a pressed state
|
||||||
|
Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan; //the next frame is within an allowable time span
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool IsImportant([NotNull] TFrame frame) => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the current frame based on an incoming time value.
|
/// Update the current frame based on an incoming time value.
|
||||||
|
Loading…
Reference in New Issue
Block a user