diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-20 10:44:50 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-26 19:43:53 +0200 |
commit | 192201c481dd6ad837afeb83032fdd685d4ff8e3 (patch) | |
tree | 0808112de4cfdefd6d2be82022861d2454b6075c | |
parent | eec2083fabcea61a1dc8226a3b76d21514f32d1a (diff) |
various null pointer checks
3 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java index 333bb58c9..3a479dc6e 100644 --- a/src/main/java/de/pixart/messenger/entities/Account.java +++ b/src/main/java/de/pixart/messenger/entities/Account.java @@ -298,7 +298,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) { diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index d1250c1d6..99a44303f 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -314,6 +314,9 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } private void populateView() { + if (contact == null) { + return; + } invalidateOptionsMenu(); setTitle(contact.getDisplayName()); if (contact.showInRoster()) { diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 931a2dbae..40929a9ea 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -815,8 +815,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU switch (intent.getAction()) { case Intent.ACTION_SENDTO: case Intent.ACTION_VIEW: - Log.d(Config.LOGTAG, "received uri=" + intent.getData()); - return new Invite(intent.getData()).invite(); + 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) { |