1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Move operation to after user population

This commit is contained in:
Dean Herbert 2023-10-30 15:46:09 +09:00
parent 96dd7b3333
commit c1c8e2968f
No known key found for this signature in database

View File

@ -87,9 +87,6 @@ namespace osu.Game.Scoring
if (!model.Ruleset.IsManaged)
model.Ruleset = realm.Find<RulesetInfo>(model.Ruleset.ShortName)!;
if (api.IsLoggedIn && api.LocalUser.Value.OnlineID == model.UserID && (model.BeatmapInfo.LastPlayed == null || model.Date > model.BeatmapInfo.LastPlayed))
model.BeatmapInfo.LastPlayed = model.Date;
// These properties are known to be non-null, but these final checks ensure a null hasn't come from somewhere (or the refetch has failed).
// Under no circumstance do we want these to be written to realm as null.
ArgumentNullException.ThrowIfNull(model.BeatmapInfo);
@ -185,6 +182,12 @@ namespace osu.Game.Scoring
base.PostImport(model, realm, parameters);
populateUserDetails(model);
Debug.Assert(model.BeatmapInfo != null);
// This needs to be run after user detail population to ensure we have a valid user id.
if (api.IsLoggedIn && api.LocalUser.Value.OnlineID == model.UserID && (model.BeatmapInfo.LastPlayed == null || model.Date > model.BeatmapInfo.LastPlayed))
model.BeatmapInfo.LastPlayed = model.Date;
}
/// <summary>