do not crash on some very rare logging

This commit is contained in:
Daniel Gultsch 2017-08-07 15:55:56 +02:00
parent ed4a190793
commit 4a43df8c97
2 changed files with 6 additions and 1 deletions

View File

@ -1275,7 +1275,7 @@ public class XmppConnectionService extends Service {
if (message.fixCounterpart()) { if (message.fixCounterpart()) {
conversation.startOtrSession(message.getCounterpart().getResourcepart(), true); conversation.startOtrSession(message.getCounterpart().getResourcepart(), true);
} else { } else {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": could not fix counterpart for OTR message to contact "+message.getContact().getJid()); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": could not fix counterpart for OTR message to contact "+message.getCounterpart());
break; break;
} }
} else { } else {
@ -1838,6 +1838,10 @@ public class XmppConnectionService extends Service {
try { try {
X509Certificate[] chain = KeyChain.getCertificateChain(XmppConnectionService.this, alias); X509Certificate[] chain = KeyChain.getCertificateChain(XmppConnectionService.this, alias);
Pair<Jid, String> info = CryptoHelper.extractJidAndName(chain[0]); Pair<Jid, String> info = CryptoHelper.extractJidAndName(chain[0]);
if (info == null) {
callback.informUser(R.string.certificate_does_not_contain_jid);
return;
}
if (findAccountByJid(info.first) == null) { if (findAccountByJid(info.first) == null) {
Account account = new Account(info.first, ""); Account account = new Account(info.first, "");
account.setPrivateKeyAlias(alias); account.setPrivateKeyAlias(alias);

View File

@ -760,4 +760,5 @@
<string name="pref_validate_hostname">Validate hostname with DNSSEC</string> <string name="pref_validate_hostname">Validate hostname with DNSSEC</string>
<string name="pref_validate_hostname_summary">Server certificates that contain the validated hostname are considered verified</string> <string name="pref_validate_hostname_summary">Server certificates that contain the validated hostname are considered verified</string>
<string name="network_is_unreachable">Network is unreachable</string> <string name="network_is_unreachable">Network is unreachable</string>
<string name="certificate_does_not_contain_jid">Certificate does not contain a Jabber ID</string>
</resources> </resources>