Fix a crash with back button

This commit is contained in:
Thomas 2024-02-02 18:28:33 +01:00
parent 227d2ef58b
commit 096dc6e98c
2 changed files with 5 additions and 2 deletions

View File

@ -909,7 +909,10 @@ public class Helper {
if (args != null) fragment.setArguments(args); if (args != null) fragment.setArguments(args);
ft = fragmentManager.beginTransaction(); ft = fragmentManager.beginTransaction();
ft.add(containerViewId, fragment, tag); ft.add(containerViewId, fragment, tag);
if (backStackName != null) ft.addToBackStack(backStackName); if (backStackName != null) {
ft = fragmentManager.beginTransaction();
ft.addToBackStack(backStackName);
}
if (!fragmentManager.isDestroyed()) { if (!fragmentManager.isDestroyed()) {
ft.commit(); ft.commit();
} }

View File

@ -1259,7 +1259,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
if (show_pinned) { if (show_pinned) {
//Fetch pinned statuses to display them at the top //Fetch pinned statuses to display them at the top
accountsVM.getAccountStatuses(currentInstance, MainActivity.currentToken, accountId, null, null, null, null, null, false, true, MastodonHelper.statusesPerCall(requireActivity())) accountsVM.getAccountStatuses(currentInstance, MainActivity.currentToken, accountId, null, null, null, null, null, false, true, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), pinnedStatuses -> accountsVM.getAccountStatuses(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountTimeline.id, null, null, null, exclude_replies, exclude_reblogs, media_only, false, MastodonHelper.statusesPerCall(requireActivity())) .observe(getViewLifecycleOwner(), pinnedStatuses -> accountsVM.getAccountStatuses(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountId, null, null, null, exclude_replies, exclude_reblogs, media_only, false, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), otherStatuses -> { .observe(getViewLifecycleOwner(), otherStatuses -> {
if (otherStatuses != null && otherStatuses.statuses != null && pinnedStatuses != null && pinnedStatuses.statuses != null) { if (otherStatuses != null && otherStatuses.statuses != null && pinnedStatuses != null && pinnedStatuses.statuses != null) {
for (Status status : pinnedStatuses.statuses) { for (Status status : pinnedStatuses.statuses) {