Replace usage of .Result with .WaitSafelyForResult

This commit is contained in:
Dean Herbert
2022-01-03 17:31:12 +09:00
parent 031a40af6a
commit 73b40e6833
41 changed files with 121 additions and 68 deletions

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Logging;
using osu.Game.Database;
using osu.Game.Input;
@ -533,11 +534,10 @@ namespace osu.Game.Online.Chat
else if (lastClosedChannel.Type == ChannelType.PM)
{
// Try to get user in order to open PM chat
users.GetUserAsync((int)lastClosedChannel.Id).ContinueWith(u =>
users.GetUserAsync((int)lastClosedChannel.Id).ContinueWith(task =>
{
if (u.Result == null) return;
Schedule(() => CurrentChannel.Value = JoinChannel(new Channel(u.Result)));
if (task.WaitSafelyForResult() is APIUser u)
Schedule(() => CurrentChannel.Value = JoinChannel(new Channel(u)));
});
}