X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FProfileAccessor.java;h=8c7d1e4b8bd25e0502d501d2a4badd527bc42a8a;hp=97972c780653fbb93b113e5ed48a0eb98f7c9bf2;hb=87b2b8dc5a94c2af3cee7a91c122a7240044cddf;hpb=ec46afaef0469b4362e0825354f54812531003b8 diff --git a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java index 97972c7..8c7d1e4 100644 --- a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java @@ -60,15 +60,25 @@ public class ProfileAccessor extends ReflectionAccessor { /* not logged in? don’t show custom avatars, then. */ return null; } + String avatarId = profile.getAvatar(); + if (avatarId != null) { + if (core.getImage(avatarId, false) == null) { + /* avatar ID but no matching image? show nothing. */ + return null; + } + } + Sone remoteSone = profile.getSone(); + if (core.isLocalSone(remoteSone)) { + /* always show your own avatars. */ + return avatarId; + } ShowCustomAvatars showCustomAvatars = currentSone.getOptions(). getEnumOption("ShowCustomAvatars").get(); if (showCustomAvatars == ShowCustomAvatars.NEVER) { return null; } - String avatarId = profile.getAvatar(); if ((showCustomAvatars == ShowCustomAvatars.ALWAYS) || (avatarId == null)) { return avatarId; } - Sone remoteSone = profile.getSone(); if ((showCustomAvatars == ShowCustomAvatars.FOLLOWED) && currentSone.hasFriend(remoteSone.getId())) { return avatarId; }