Don't crash on recipient preference change for non-signal user

Fixes #5760
// FREEBIe
This commit is contained in:
Moxie Marlinspike 2016-10-08 14:04:33 -07:00
parent 338c0d82e1
commit 21258f244c

View File

@ -295,16 +295,16 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
@Override @Override
public void onSuccess(Optional<IdentityKey> result) { public void onSuccess(Optional<IdentityKey> result) {
if (result.isPresent()) { if (result.isPresent()) {
identityPreference.setOnPreferenceClickListener(new IdentityClickedListener(result.get())); if (identityPreference != null) identityPreference.setOnPreferenceClickListener(new IdentityClickedListener(result.get()));
identityPreference.setEnabled(true); if (identityPreference != null) identityPreference.setEnabled(true);
} else { } else {
getPreferenceScreen().removePreference(identityPreference); if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
} }
} }
@Override @Override
public void onFailure(ExecutionException e) { public void onFailure(ExecutionException e) {
getPreferenceScreen().removePreference(identityPreference); if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
} }
}); });
} }