From 501c545a1416eaf62198ca796ad24646e4d8166f Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 7 Sep 2022 18:08:22 +0200 Subject: [PATCH] Avoid some crashes when using drafts --- .../fedilab/android/ui/drawer/ComposeAdapter.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index 106cc482e..91a723a14 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -1075,11 +1075,14 @@ public class ComposeAdapter extends RecyclerView.Adapter(holder.binding.statusContent)), TextView.BufferType.SPANNABLE); MastodonHelper.loadPPMastodon(holder.binding.avatar, status.account); - holder.binding.displayName.setText( - status.account.getSpanDisplayName(context, - new WeakReference<>(holder.binding.displayName)), - TextView.BufferType.SPANNABLE); - holder.binding.username.setText(String.format("@%s", status.account.acct)); + if (status.account != null) { + holder.binding.displayName.setText( + status.account.getSpanDisplayName(context, + new WeakReference<>(holder.binding.displayName)), + TextView.BufferType.SPANNABLE); + holder.binding.username.setText(String.format("@%s", status.account.acct)); + } + if (status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) { holder.binding.spoiler.setVisibility(View.VISIBLE); holder.binding.spoiler.setText(