mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Handle virtual track string to avoid throwing later in lookup
This commit is contained in:
parent
9af81adea7
commit
e010dfb150
@ -26,6 +26,11 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
private readonly WeakList<BeatmapManagerWorkingBeatmap> workingCache = new WeakList<BeatmapManagerWorkingBeatmap>();
|
||||
|
||||
/// <summary>
|
||||
/// Beatmap files may specify this filename to denote that they don't have an audio track.
|
||||
/// </summary>
|
||||
private const string virtual_track_filename = @"virtual";
|
||||
|
||||
/// <summary>
|
||||
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
||||
/// </summary>
|
||||
@ -40,7 +45,8 @@ namespace osu.Game.Beatmaps
|
||||
[CanBeNull]
|
||||
private readonly GameHost host;
|
||||
|
||||
public WorkingBeatmapCache(ITrackStore trackStore, AudioManager audioManager, IResourceStore<byte[]> resources, IResourceStore<byte[]> files, WorkingBeatmap defaultBeatmap = null, GameHost host = null)
|
||||
public WorkingBeatmapCache(ITrackStore trackStore, AudioManager audioManager, IResourceStore<byte[]> resources, IResourceStore<byte[]> files, WorkingBeatmap defaultBeatmap = null,
|
||||
GameHost host = null)
|
||||
{
|
||||
DefaultBeatmap = defaultBeatmap;
|
||||
|
||||
@ -157,6 +163,9 @@ namespace osu.Game.Beatmaps
|
||||
if (string.IsNullOrEmpty(Metadata?.AudioFile))
|
||||
return null;
|
||||
|
||||
if (Metadata.AudioFile == virtual_track_filename)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return resources.Tracks.Get(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile));
|
||||
@ -173,6 +182,9 @@ namespace osu.Game.Beatmaps
|
||||
if (string.IsNullOrEmpty(Metadata?.AudioFile))
|
||||
return null;
|
||||
|
||||
if (Metadata.AudioFile == virtual_track_filename)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
var trackData = GetStream(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile));
|
||||
|
Loading…
Reference in New Issue
Block a user