Fix failing testcase (nullref).

This commit is contained in:
Dean Herbert 2017-02-27 16:37:49 +09:00
parent 7c602a2af3
commit 68dd3c02aa
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
1 changed files with 8 additions and 5 deletions

View File

@ -9,6 +9,7 @@
using osu.Framework.Graphics.Transforms;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Backgrounds;
@ -125,6 +126,8 @@ public MetadataLine(string left, string right)
public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
{
var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
@ -138,7 +141,7 @@ public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
{
new OsuSpriteText
{
Text = beatmap.BeatmapInfo.Metadata.Title,
Text = metadata.Title,
TextSize = 36,
Font = @"Exo2.0-MediumItalic",
Origin = Anchor.TopCentre,
@ -146,7 +149,7 @@ public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
},
new OsuSpriteText
{
Text = beatmap.BeatmapInfo.Metadata.Artist,
Text = metadata.Artist,
TextSize = 26,
Font = @"Exo2.0-MediumItalic",
Origin = Anchor.TopCentre,
@ -173,7 +176,7 @@ public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
},
new OsuSpriteText
{
Text = beatmap.BeatmapInfo.Version,
Text = beatmap.BeatmapInfo?.Version,
TextSize = 26,
Font = @"Exo2.0-MediumItalic",
Origin = Anchor.TopCentre,
@ -183,7 +186,7 @@ public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
Bottom = 40
},
},
new MetadataLine("Source", beatmap.BeatmapInfo.Metadata.Source)
new MetadataLine("Source", metadata.Source)
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
@ -193,7 +196,7 @@ public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
new MetadataLine("Mapper", beatmap.BeatmapInfo.Metadata.Author)
new MetadataLine("Mapper", metadata.Author)
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,