Use debug.assert for better readable.

This commit is contained in:
andy840119 2022-07-03 19:27:56 +08:00
parent 0a1543c6e8
commit 8c2f4b48fc
2 changed files with 7 additions and 4 deletions

View File

@ -9,7 +9,6 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
@ -189,7 +188,10 @@ public void HandleFrame(ReplayFrame frame) => Schedule(() =>
}
if (frame is IConvertibleReplayFrame convertible)
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap.AsNonNull()));
{
Debug.Assert(currentBeatmap != null);
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap));
}
if (pendingFrames.Count > max_pending_frames)
purgePendingFrames();

View File

@ -2,11 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using osu.Framework.Extensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Extensions;
@ -144,7 +144,8 @@ private LegacyReplayFrame getLegacyFrame(ReplayFrame replayFrame)
return legacyFrame;
case IConvertibleReplayFrame convertibleFrame:
return convertibleFrame.ToLegacy(beatmap.AsNonNull());
Debug.Assert(beatmap != null);
return convertibleFrame.ToLegacy(beatmap);
default:
throw new ArgumentException(@"Frame could not be converted to legacy frames", nameof(replayFrame));