mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-25 22:49:51 +01:00
Merge pull request #2882 from nextcloud/bgfix/noid/avoidNpeLoadAvatarImage
Avoid NPE in loadAvatarImage
This commit is contained in:
commit
45deb7fec5
@ -269,13 +269,13 @@ public class DisplayUtils {
|
|||||||
lastStartIndex = end;
|
lastStartIndex = end;
|
||||||
|
|
||||||
Drawable drawableForChip = DisplayUtils.getDrawableForMentionChipSpan(context,
|
Drawable drawableForChip = DisplayUtils.getDrawableForMentionChipSpan(context,
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
conversationUser,
|
conversationUser,
|
||||||
type,
|
type,
|
||||||
chipXmlRes,
|
chipXmlRes,
|
||||||
null,
|
null,
|
||||||
viewThemeUtils);
|
viewThemeUtils);
|
||||||
|
|
||||||
mentionChipSpan = new Spans.MentionChipSpan(drawableForChip,
|
mentionChipSpan = new Spans.MentionChipSpan(drawableForChip,
|
||||||
BetterImageSpan.ALIGN_CENTER,
|
BetterImageSpan.ALIGN_CENTER,
|
||||||
@ -453,18 +453,20 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadAvatarImage(User user, ImageView avatarImageView, boolean deleteCache) {
|
public static void loadAvatarImage(User user, ImageView avatarImageView, boolean deleteCache) {
|
||||||
String avatarId;
|
if (user != null && avatarImageView != null) {
|
||||||
if (!TextUtils.isEmpty(user.getUserId())) {
|
String avatarId;
|
||||||
avatarId = user.getUserId();
|
if (!TextUtils.isEmpty(user.getUserId())) {
|
||||||
} else {
|
avatarId = user.getUserId();
|
||||||
avatarId = user.getUsername();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avatarId != null) {
|
|
||||||
if (deleteCache) {
|
|
||||||
ImageViewExtensionsKt.replaceAvatar(avatarImageView, user, avatarId, true);
|
|
||||||
} else {
|
} else {
|
||||||
ImageViewExtensionsKt.loadAvatar(avatarImageView, user, avatarId, true);
|
avatarId = user.getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (avatarId != null) {
|
||||||
|
if (deleteCache) {
|
||||||
|
ImageViewExtensionsKt.replaceAvatar(avatarImageView, user, avatarId, true);
|
||||||
|
} else {
|
||||||
|
ImageViewExtensionsKt.loadAvatar(avatarImageView, user, avatarId, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user