fix daily note fetch uid crash

This commit is contained in:
DismissedLight
2023-12-23 18:22:12 +08:00
parent 24a2a18760
commit e6cf39831d
2 changed files with 2 additions and 12 deletions

View File

@@ -77,7 +77,7 @@ internal sealed partial class DailyNoteService : IDailyNoteService, IRecipient<U
List<DailyNoteEntry> entryList = await dailyNoteDbService.GetDailyNoteEntryIncludeUserListAsync().ConfigureAwait(false);
entryList.ForEach(entry => { entry.UserGameRole = userService.GetUserGameRoleByUid(entry.Uid); });
entries = new(entryList);
entries = entryList.ToObservableCollection();
}
return entries;

View File

@@ -131,17 +131,7 @@ internal sealed partial class UserCollectionService : IUserCollectionService
return default;
}
try
{
return uidUserGameRoleMap[uid];
}
catch (InvalidOperationException)
{
// Sequence contains more than one matching element
// TODO: return a specialize UserGameRole to indicate error
}
return default;
return uidUserGameRoleMap.GetValueOrDefault(uid);
}
public bool TryGetUserByMid(string mid, [NotNullWhen(true)] out BindingUser? user)