mirror of
https://github.com/ppy/osu
synced 2025-01-10 16:19:47 +00:00
Merge pull request #17431 from peppy/fix-participants-panel-null-ref
Guard against potential null `CurrentItem` in `ParticipantPanel`
This commit is contained in:
commit
def2ce243f
@ -171,6 +171,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
Room = joinedRoom;
|
||||
APIRoom = room;
|
||||
|
||||
Debug.Assert(joinedRoom.Playlist.Count > 0);
|
||||
|
||||
APIRoom.Playlist.Clear();
|
||||
APIRoom.Playlist.AddRange(joinedRoom.Playlist.Select(createPlaylistItem));
|
||||
|
||||
@ -683,6 +685,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
Room.Playlist.Remove(Room.Playlist.Single(existing => existing.ID == playlistItemId));
|
||||
APIRoom.Playlist.RemoveAll(existing => existing.ID == playlistItemId);
|
||||
|
||||
Debug.Assert(Room.Playlist.Count > 0);
|
||||
|
||||
ItemRemoved?.Invoke(playlistItemId);
|
||||
RoomUpdated?.Invoke();
|
||||
});
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -187,9 +186,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
const double fade_time = 50;
|
||||
|
||||
var currentItem = Playlist.GetCurrentItem();
|
||||
Debug.Assert(currentItem != null);
|
||||
|
||||
var ruleset = rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance();
|
||||
var ruleset = currentItem != null ? rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance() : null;
|
||||
|
||||
int? currentModeRank = ruleset != null ? User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank : null;
|
||||
userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;
|
||||
|
Loading…
Reference in New Issue
Block a user