diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java index 38b4d9ae6..4500fac60 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsFragment.java @@ -232,7 +232,7 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc @Override public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){ FrameLayout view=tabViews[viewType]; - ((ViewGroup)view.getParent()).removeView(view); + if (view.getParent() != null) ((ViewGroup)view.getParent()).removeView(view); view.setVisibility(View.VISIBLE); view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return new SimpleViewHolder(view); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index e4d087476..648c017c0 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -1133,7 +1133,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList @Override public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){ FrameLayout view=tabViews[viewType]; - ((ViewGroup)view.getParent()).removeView(view); + if (view.getParent() != null) ((ViewGroup)view.getParent()).removeView(view); view.setVisibility(View.VISIBLE); view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return new SimpleViewHolder(view);