From 32df02084db91ecb7ab419a04df4f60d61f30ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 27 Mar 2021 20:00:49 +0100 Subject: [PATCH] Extract variable to avoid redundant accesses --- osu.Game/Users/Drawables/DrawableAvatar.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/Drawables/DrawableAvatar.cs b/osu.Game/Users/Drawables/DrawableAvatar.cs index 079d4a932c..c672c6fa1d 100644 --- a/osu.Game/Users/Drawables/DrawableAvatar.cs +++ b/osu.Game/Users/Drawables/DrawableAvatar.cs @@ -34,8 +34,9 @@ namespace osu.Game.Users.Drawables [BackgroundDependencyLoader] private void load(LargeTextureStore textures) { - if (api != null && user?.AvatarUrl != null) - Texture = textures.Get(user.AvatarUrl.StartsWith('/') ? $"{api.WebsiteRootUrl}{user.AvatarUrl}" : user.AvatarUrl); + string avatarUrl = user?.AvatarUrl; + if (api != null && avatarUrl != null) + Texture = textures.Get(avatarUrl.StartsWith('/') ? $"{api.WebsiteRootUrl}{avatarUrl}" : avatarUrl); else if (user != null && user.Id > 1) Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");