mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Fix some nullrefs when running visualtests with no maps loaded.
This commit is contained in:
parent
d17bef12b6
commit
162e183b36
@ -29,7 +29,9 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDatabase db)
|
||||
{
|
||||
beatmap = db.GetWorkingBeatmap(db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault());
|
||||
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
|
||||
if (beatmapInfo != null)
|
||||
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
Texture = working.Background;
|
||||
if (working.Background != null)
|
||||
Texture = working.Background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
if (background != null) return background;
|
||||
|
||||
if (BeatmapInfo.Metadata?.BackgroundFile == null) return null;
|
||||
|
||||
try
|
||||
{
|
||||
using (var reader = GetReader())
|
||||
|
@ -56,8 +56,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
string hitType = (HitObject.Sample.Type == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
||||
string sampleSet = HitObject.Sample.Set.ToString().ToLower();
|
||||
string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
||||
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
|
||||
|
||||
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user