1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 01:37:31 +08:00

Merge pull request #20366 from peppy/fix-nullable-download-progress

Fix multiplayer crashes due to incorrect download state
This commit is contained in:
Dan Balasescu 2022-09-20 17:16:11 +09:00 committed by GitHub
commit 80d8eedb7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -25,9 +22,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
{
private const double fade_time = 50;
private SpriteIcon icon;
private OsuSpriteText text;
private ProgressBar progressBar;
private SpriteIcon icon = null!;
private OsuSpriteText text = null!;
private ProgressBar progressBar = null!;
public StateDisplay()
{
@ -86,7 +83,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
};
}
private OsuColour colours;
private OsuColour colours = null!;
public void UpdateStatus(MultiplayerUserState state, BeatmapAvailability availability)
{
@ -164,10 +161,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
break;
case DownloadState.Downloading:
Debug.Assert(availability.DownloadProgress != null);
progressBar.FadeIn(fade_time);
progressBar.CurrentTime = availability.DownloadProgress.Value;
progressBar.CurrentTime = availability.DownloadProgress ?? 0;
text.Text = "downloading map";
icon.Icon = FontAwesome.Solid.ArrowAltCircleDown;