avoid some NPEs

This commit is contained in:
Daniel Gultsch 2015-12-04 15:35:22 +01:00
parent 3e3cb047be
commit 0664d6ac7b
2 changed files with 4 additions and 3 deletions

View file

@ -365,7 +365,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
break; break;
case Message.ENCRYPTION_AXOLOTL: case Message.ENCRYPTION_AXOLOTL:
AxolotlService axolotlService = conversation.getAccount().getAxolotlService(); AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
if (axolotlService.trustedSessionVerified(conversation)) { if (axolotlService != null && axolotlService.trustedSessionVerified(conversation)) {
mEditMessage.setHint(getString(R.string.send_omemo_x509_message)); mEditMessage.setHint(getString(R.string.send_omemo_x509_message));
} else { } else {
mEditMessage.setHint(getString(R.string.send_omemo_message)); mEditMessage.setHint(getString(R.string.send_omemo_message));

View file

@ -227,10 +227,11 @@ public class DNSHelper {
} }
public static boolean isIp(final String server) { 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.matcher(server).matches()
|| PATTERN_IPV6_6HEX4DEC.matcher(server).matches() || PATTERN_IPV6_6HEX4DEC.matcher(server).matches()
|| PATTERN_IPV6_HEX4DECCOMPRESSED.matcher(server).matches() || PATTERN_IPV6_HEX4DECCOMPRESSED.matcher(server).matches()
|| PATTERN_IPV6_HEXCOMPRESSED.matcher(server).matches(); || PATTERN_IPV6_HEXCOMPRESSED.matcher(server).matches());
} }
} }