mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Merge pull request #17761 from peppy/fix-drawable-room-null-reference
Fix potential crash in `DrawableRoom` due to lack of null check on post-lookup beatmap
This commit is contained in:
commit
489f064b13
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
@ -34,9 +35,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestMultipleStatuses()
|
public void TestMultipleStatuses()
|
||||||
{
|
{
|
||||||
|
FillFlowContainer rooms = null;
|
||||||
|
|
||||||
AddStep("create rooms", () =>
|
AddStep("create rooms", () =>
|
||||||
{
|
{
|
||||||
Child = new FillFlowContainer
|
Child = rooms = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -124,6 +127,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for panel load", () => rooms.Count == 5);
|
||||||
|
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2);
|
||||||
|
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -418,10 +418,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
var retrievedBeatmap = task.GetResultSafely();
|
var retrievedBeatmap = task.GetResultSafely();
|
||||||
|
|
||||||
statusText.Text = "Currently playing ";
|
statusText.Text = "Currently playing ";
|
||||||
beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
|
|
||||||
LinkAction.OpenBeatmap,
|
if (retrievedBeatmap != null)
|
||||||
retrievedBeatmap.OnlineID.ToString(),
|
{
|
||||||
creationParameters: s => s.Truncate = true);
|
beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
|
||||||
|
LinkAction.OpenBeatmap,
|
||||||
|
retrievedBeatmap.OnlineID.ToString(),
|
||||||
|
creationParameters: s => s.Truncate = true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
beatmapText.AddText("unknown beatmap");
|
||||||
}), cancellationSource.Token);
|
}), cancellationSource.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user