aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-08-20 10:44:50 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-08-20 10:44:50 +0200
commit8927ba8065fd145fb6c8eeceaa6a807a7ee6d4f0 (patch)
tree07bc600e018fe9e9ab82b7b22c186c8f04bc4a6c
parenta0038565c582ee630e80ed61d346133c8ba1988e (diff)
various null pointer checks
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java9
3 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index b3694108..23001de7 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -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) {
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index c6df77dc..d663cbd1 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -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()) {
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index 67c97dd1..cc7394b4 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/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) {