From d97a78362cfffa891a4604921036a74c557f673c Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 9 Jan 2023 17:37:56 +0100 Subject: [PATCH] Fix crashes --- .../main/java/app/fedilab/android/helper/SpannableHelper.java | 4 +++- .../android/ui/fragment/media/FragmentMediaProfile.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java index f53c1172..e030eeae 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -99,7 +99,9 @@ public class SpannableHelper { public static Spannable convert(Context context, String text, Status status, Account account, Announcement announcement, WeakReference viewWeakReference, Status.Callback callback) { - + if (text == null) { + return null; + } SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMediaProfile.java b/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMediaProfile.java index 86670549..fe42a549 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMediaProfile.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMediaProfile.java @@ -74,7 +74,7 @@ public class FragmentMediaProfile extends Fragment { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); flagLoading = false; - accountsVM = new ViewModelProvider(FragmentMediaProfile.this).get(AccountsVM.class); + accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class); mediaStatuses = new ArrayList<>(); if (checkRemotely) {