Fix possible NPE when using a TextView

This commit is contained in:
Daniel Martí 2015-05-01 00:32:20 +02:00
parent bc98fd69b1
commit e314c401e7

View File

@ -71,9 +71,10 @@ public class ConfirmReceiveSwapFragment extends Fragment implements ProgressList
super.onResume();
newRepoConfig = new NewRepoConfig(getActivity(), getActivity().getIntent());
if (newRepoConfig.isValidRepo()) {
((TextView) getView().findViewById(R.id.text_description)).setText(
getString(R.string.swap_confirm_connect, newRepoConfig.getHost())
);
TextView tv = (TextView) getView().findViewById(R.id.text_description);
if (tv != null) {
tv.setText(getString(R.string.swap_confirm_connect, newRepoConfig.getHost()));
}
} else {
// TODO: Show error message on screen (not in popup).
// TODO: I don't think we want to continue with this at all if the repo config is invalid,