1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Extract variable to avoid redundant accesses

This commit is contained in:
Bartłomiej Dach 2021-03-27 20:00:49 +01:00
parent be08460bea
commit 32df02084d

View File

@ -34,8 +34,9 @@ namespace osu.Game.Users.Drawables
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LargeTextureStore textures) private void load(LargeTextureStore textures)
{ {
if (api != null && user?.AvatarUrl != null) string avatarUrl = user?.AvatarUrl;
Texture = textures.Get(user.AvatarUrl.StartsWith('/') ? $"{api.WebsiteRootUrl}{user.AvatarUrl}" : user.AvatarUrl); if (api != null && avatarUrl != null)
Texture = textures.Get(avatarUrl.StartsWith('/') ? $"{api.WebsiteRootUrl}{avatarUrl}" : avatarUrl);
else if (user != null && user.Id > 1) else if (user != null && user.Id > 1)
Texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");