various null pointer checks

This commit is contained in:
Daniel Gultsch 2016-08-20 10:44:50 +02:00
parent a0038565c5
commit 8927ba8065
3 changed files with 12 additions and 3 deletions

View file

@ -302,7 +302,8 @@ public class Account extends AbstractEntity {
}
public boolean isOnion() {
return getServer().toString().toLowerCase().endsWith(".onion");
final Jid server = getServer();
return server != null && server.toString().toLowerCase().endsWith(".onion");
}
public void setPort(int port) {

View file

@ -313,6 +313,9 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
}
private void populateView() {
if (contact == null) {
return;
}
invalidateOptionsMenu();
setTitle(contact.getDisplayName());
if (contact.showInRoster()) {

View file

@ -815,8 +815,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
switch (intent.getAction()) {
case Intent.ACTION_SENDTO:
case Intent.ACTION_VIEW:
Uri uri = intent.getData();
if (uri != null) {
Log.d(Config.LOGTAG, "received uri=" + intent.getData());
return new Invite(intent.getData()).invite();
} else {
return false;
}
case NfcAdapter.ACTION_NDEF_DISCOVERED:
for (Parcelable message : getIntent().getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)) {
if (message instanceof NdefMessage) {