From 1a3907936da5a3a76f23517f393302dd300a0824 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Thu, 8 Feb 2018 19:17:08 +0100 Subject: [PATCH] fix crash in ComposeActivity when account has no profile picture set --- .../com/keylesspalace/tusky/ComposeActivity.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 151b356d1..7a3f452a1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -456,11 +456,15 @@ public final class ComposeActivity extends BaseActivity ImageView composeAvatar = findViewById(R.id.composeAvatar); - Picasso.with(this).load(activeAccount.getProfilePictureUrl()) - .transform(new RoundedTransformation(7, 0)) - .error(R.drawable.avatar_default) - .placeholder(R.drawable.avatar_default) - .into(composeAvatar); + if(TextUtils.isEmpty(activeAccount.getProfilePictureUrl())) { + composeAvatar.setImageResource(R.drawable.avatar_default); + } else { + Picasso.with(this).load(activeAccount.getProfilePictureUrl()) + .transform(new RoundedTransformation(7, 0)) + .error(R.drawable.avatar_default) + .placeholder(R.drawable.avatar_default) + .into(composeAvatar); + } composeAvatar.setContentDescription( getString(R.string.compose_active_account_description,