aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-12-04 15:35:22 +0100
committerDaniel Gultsch <daniel@gultsch.de>2015-12-04 15:35:22 +0100
commit0664d6ac7b8d0cefac8fa92df625fe653d606b1a (patch)
tree2ce1c1cb8272b50c215976db8bbaa1bb14551237
parent3e3cb047be7f63233f766a022e9cf9ba8827094d (diff)
avoid some NPEs
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/DNSHelper.java5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index f7a0e2109..ab1319ef8 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -365,7 +365,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
break;
case Message.ENCRYPTION_AXOLOTL:
AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
- if (axolotlService.trustedSessionVerified(conversation)) {
+ if (axolotlService != null && axolotlService.trustedSessionVerified(conversation)) {
mEditMessage.setHint(getString(R.string.send_omemo_x509_message));
} else {
mEditMessage.setHint(getString(R.string.send_omemo_message));
diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
index f3c4f79a2..e07df627e 100644
--- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
@@ -227,10 +227,11 @@ public class DNSHelper {
}
public static boolean isIp(final String server) {
- return PATTERN_IPV4.matcher(server).matches()
+ return server != null && (
+ PATTERN_IPV4.matcher(server).matches()
|| PATTERN_IPV6.matcher(server).matches()
|| PATTERN_IPV6_6HEX4DEC.matcher(server).matches()
|| PATTERN_IPV6_HEX4DECCOMPRESSED.matcher(server).matches()
- || PATTERN_IPV6_HEXCOMPRESSED.matcher(server).matches();
+ || PATTERN_IPV6_HEXCOMPRESSED.matcher(server).matches());
}
}