Fixed NPE

This commit is contained in:
Christian Basler 2015-06-23 22:29:44 +02:00
parent 3b3e972c99
commit b150d08188

View File

@ -91,6 +91,7 @@ class DefaultMessageListener implements NetworkHandler.MessageListener {
if (address != null) { if (address != null) {
address.setPubkey(pubkey); address.setPubkey(pubkey);
LOG.debug("Got pubkey for contact " + address); LOG.debug("Got pubkey for contact " + address);
ctx.getAddressRepo().save(address);
List<Plaintext> messages = ctx.getMessageRepository().findMessages(Plaintext.Status.PUBKEY_REQUESTED, address); List<Plaintext> messages = ctx.getMessageRepository().findMessages(Plaintext.Status.PUBKEY_REQUESTED, address);
LOG.debug("Sending " + messages.size() + " messages for contact " + address); LOG.debug("Sending " + messages.size() + " messages for contact " + address);
for (Plaintext msg : messages) { for (Plaintext msg : messages) {
@ -107,7 +108,6 @@ class DefaultMessageListener implements NetworkHandler.MessageListener {
msg.setStatus(SENT); msg.setStatus(SENT);
ctx.getMessageRepository().save(msg); ctx.getMessageRepository().save(msg);
} }
ctx.getAddressRepo().save(address);
} }
} catch (DecryptionFailedException ignore) { } catch (DecryptionFailedException ignore) {
} }