Fix crash when opening reactions bottom sheet.

This commit is contained in:
Alex Hart
2022-01-20 11:25:32 -04:00
committed by Greyson Parrelli
parent fd6a2c6b10
commit 6919e352d6
2 changed files with 16 additions and 6 deletions

View File

@@ -57,7 +57,13 @@ public final class ReactionsBottomSheetDialogFragment extends BottomSheetDialogF
public void onAttach(@NonNull Context context) {
super.onAttach(context);
callback = (Callback) context;
if (context instanceof Callback) {
callback = (Callback) context;
} else if (getParentFragment() instanceof Callback) {
callback = (Callback) getParentFragment();
} else {
throw new IllegalStateException("Parent component does not implement Callback");
}
}
@Override