mirror of
https://github.com/ppy/osu.git
synced 2025-03-04 05:22:54 +08:00
Fix possibly setting null track
This commit is contained in:
parent
08820c62ec
commit
b6fb7a0d39
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddStep("Set activity", () => API.Activity.Value = new UserActivity.InLobby());
|
AddStep("Set activity", () => API.Activity.Value = new UserActivity.InLobby());
|
||||||
|
|
||||||
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(null, null)
|
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo = { OnlineBeatmapID = hasOnlineId ? 1234 : (int?)null }
|
BeatmapInfo = { OnlineBeatmapID = hasOnlineId ? 1234 : (int?)null }
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
@ -19,7 +20,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
private readonly TextureStore textures;
|
private readonly TextureStore textures;
|
||||||
|
|
||||||
public DummyWorkingBeatmap(AudioManager audio, TextureStore textures)
|
public DummyWorkingBeatmap([NotNull] AudioManager audio, TextureStore textures)
|
||||||
: base(new BeatmapInfo
|
: base(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
|
@ -321,15 +321,13 @@ namespace osu.Game.Overlays
|
|||||||
private void changeTrack()
|
private void changeTrack()
|
||||||
{
|
{
|
||||||
CurrentTrack.Expire();
|
CurrentTrack.Expire();
|
||||||
CurrentTrack = null;
|
CurrentTrack = new DrawableTrack(new TrackVirtual(1000));
|
||||||
|
|
||||||
if (current != null)
|
if (current != null)
|
||||||
{
|
|
||||||
CurrentTrack = new DrawableTrack(current.GetRealTrack());
|
CurrentTrack = new DrawableTrack(current.GetRealTrack());
|
||||||
CurrentTrack.Completed += () => onTrackCompleted(current);
|
|
||||||
|
|
||||||
AddInternal(CurrentTrack);
|
CurrentTrack.Completed += () => onTrackCompleted(current);
|
||||||
}
|
AddInternal(CurrentTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTrackCompleted(WorkingBeatmap workingBeatmap)
|
private void onTrackCompleted(WorkingBeatmap workingBeatmap)
|
||||||
|
Loading…
Reference in New Issue
Block a user