1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:33:05 +08:00

Fix potential nullref in ContextMenuItems

This commit is contained in:
Salman Ahmed 2022-07-14 05:01:18 +03:00
parent cb2f0b8c67
commit a85a70c472

View File

@ -8,6 +8,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -94,6 +95,7 @@ namespace osu.Game.Screens.OnlinePlay
private PanelBackground panelBackground; private PanelBackground panelBackground;
private FillFlowContainer mainFillFlow; private FillFlowContainer mainFillFlow;
[CanBeNull]
private BeatmapDownloadTracker downloadTracker; private BeatmapDownloadTracker downloadTracker;
[Resolved] [Resolved]
@ -503,7 +505,7 @@ namespace osu.Game.Screens.OnlinePlay
if (beatmapOverlay != null) if (beatmapOverlay != null)
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID))); items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID)));
if (beatmap != null && collectionManager != null && downloadTracker.State.Value == DownloadState.LocallyAvailable) if (beatmap != null && collectionManager != null && downloadTracker?.State.Value == DownloadState.LocallyAvailable)
{ {
var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast<OsuMenuItem>().ToList(); var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast<OsuMenuItem>().ToList();
if (manageCollectionsDialog != null) if (manageCollectionsDialog != null)