I'd prefer
```
if (view == null || view.getActivity() == null) return;

view.getActivity().finish();
```