mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Handle nulls and fix missing documentation
This commit is contained in:
parent
77adf687c6
commit
459f9a0465
@ -32,7 +32,7 @@ namespace osu.Game.Database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userIds">The users to lookup.</param>
|
/// <param name="userIds">The users to lookup.</param>
|
||||||
/// <param name="token">An optional cancellation token.</param>
|
/// <param name="token">An optional cancellation token.</param>
|
||||||
/// <returns>.</returns>
|
/// <returns>The populated users. May include null results for failed retrievals.</returns>
|
||||||
public Task<User[]> GetUsersAsync(int[] userIds, CancellationToken token = default)
|
public Task<User[]> GetUsersAsync(int[] userIds, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var userLookupTasks = new List<Task<User>>();
|
var userLookupTasks = new List<Task<User>>();
|
||||||
|
@ -57,6 +57,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
foreach (var user in users.Result)
|
foreach (var user in users.Result)
|
||||||
{
|
{
|
||||||
|
if (user == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
var trackedUser = CreateUserData(user.Id, scoreProcessor);
|
var trackedUser = CreateUserData(user.Id, scoreProcessor);
|
||||||
trackedUser.ScoringMode.BindTo(scoringMode);
|
trackedUser.ScoringMode.BindTo(scoringMode);
|
||||||
|
|
||||||
|
@ -63,7 +63,12 @@ namespace osu.Game.Screens.Spectate
|
|||||||
userLookupCache.GetUsersAsync(userIds.ToArray()).ContinueWith(users => Schedule(() =>
|
userLookupCache.GetUsersAsync(userIds.ToArray()).ContinueWith(users => Schedule(() =>
|
||||||
{
|
{
|
||||||
foreach (var u in users.Result)
|
foreach (var u in users.Result)
|
||||||
|
{
|
||||||
|
if (u == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
userMap[u.Id] = u;
|
userMap[u.Id] = u;
|
||||||
|
}
|
||||||
|
|
||||||
playingUserStates.BindTo(spectatorClient.PlayingUserStates);
|
playingUserStates.BindTo(spectatorClient.PlayingUserStates);
|
||||||
playingUserStates.BindCollectionChanged(onPlayingUserStatesChanged, true);
|
playingUserStates.BindCollectionChanged(onPlayingUserStatesChanged, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user