mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Fix crash on gameplay startup if beatmap has no background
This commit is contained in:
parent
c820d445ad
commit
b80c02b757
@ -77,10 +77,14 @@ namespace osu.Game.Storyboards
|
||||
{
|
||||
get
|
||||
{
|
||||
string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile.ToLowerInvariant();
|
||||
string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile;
|
||||
|
||||
if (string.IsNullOrEmpty(backgroundPath))
|
||||
return false;
|
||||
|
||||
// Importantly, do this after the NullOrEmpty because EF may have stored the non-nullable value as null to the database, bypassing compile-time constraints.
|
||||
backgroundPath = backgroundPath.ToLowerInvariant();
|
||||
|
||||
return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath);
|
||||
}
|
||||
}
|
||||
@ -93,7 +97,7 @@ namespace osu.Game.Storyboards
|
||||
Drawable drawable = null;
|
||||
string storyboardPath = BeatmapInfo.BeatmapSet?.Files.Find(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
|
||||
|
||||
if (storyboardPath != null)
|
||||
if (!string.IsNullOrEmpty(storyboardPath))
|
||||
drawable = new Sprite { Texture = textureStore.Get(storyboardPath) };
|
||||
// if the texture isn't available locally in the beatmap, some storyboards choose to source from the underlying skin lookup hierarchy.
|
||||
else if (UseSkinSprites)
|
||||
|
Loading…
Reference in New Issue
Block a user