Fix potential NPE in MediaOverviewPageFragment.

This commit is contained in:
Greyson Parrelli 2023-07-07 11:04:33 -04:00 committed by Clark Chen
parent 159f2ebec0
commit c359207f1f

View file

@ -211,9 +211,11 @@ public final class MediaOverviewPageFragment extends Fragment
@Override
public void onDestroy() {
super.onDestroy();
int childCount = recyclerView.getChildCount();
for (int i = 0; i < childCount; i++) {
adapter.detach(recyclerView.getChildViewHolder(recyclerView.getChildAt(i)));
if (recyclerView != null) {
int childCount = recyclerView.getChildCount();
for (int i = 0; i < childCount; i++) {
adapter.detach(recyclerView.getChildViewHolder(recyclerView.getChildAt(i)));
}
}
}