mirror of
https://github.com/ppy/osu
synced 2024-12-26 17:02:59 +00:00
Fix lookup cache throwing a null reference if no matches were successful
This commit is contained in:
parent
6849eabf2c
commit
4d61c143db
@ -72,6 +72,7 @@ namespace osu.Game.Database
|
||||
var request = new GetUsersRequest(userTasks.Keys.ToArray());
|
||||
|
||||
// rather than queueing, we maintain our own single-threaded request stream.
|
||||
// todo: we probably want retry logic here.
|
||||
api.Perform(request);
|
||||
|
||||
// Create a new request task if there's still more users to query.
|
||||
@ -82,14 +83,19 @@ namespace osu.Game.Database
|
||||
createNewTask();
|
||||
}
|
||||
|
||||
foreach (var user in request.Result.Users)
|
||||
{
|
||||
if (userTasks.TryGetValue(user.Id, out var tasks))
|
||||
{
|
||||
foreach (var task in tasks)
|
||||
task.SetResult(user);
|
||||
List<User> foundUsers = request.Result?.Users;
|
||||
|
||||
userTasks.Remove(user.Id);
|
||||
if (foundUsers != null)
|
||||
{
|
||||
foreach (var user in foundUsers)
|
||||
{
|
||||
if (userTasks.TryGetValue(user.Id, out var tasks))
|
||||
{
|
||||
foreach (var task in tasks)
|
||||
task.SetResult(user);
|
||||
|
||||
userTasks.Remove(user.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user