Skip to content

Commit

Permalink
Use debug.assert for better readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 3, 2022
1 parent 0a1543c commit 8c2f4b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions osu.Game/Online/Spectator/SpectatorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 8c2f4b4

Please sign in to comment.