From 72e1612f32beae415828918bec7365a4bebdfe93 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 14 Mar 2017 19:40:51 +0900 Subject: [PATCH] Null-safety in the case where there are no HitObjects. --- osu.Game/Modes/Objects/HitObject.cs | 1 - osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index 4df1354adf..e43702e2da 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; namespace osu.Game.Modes.Objects diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 2461e80ab7..5264bee78c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -77,8 +77,8 @@ namespace osu.Game.Screens.Select if (beatmap.Beatmap != null) { - HitObject lastObject = beatmap.Beatmap.HitObjects.Last(); - double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime; + HitObject lastObject = beatmap.Beatmap.HitObjects.LastOrDefault(); + double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; labels.Add(new InfoLabel(new BeatmapStatistic {