Fixed a NullPointerException when a local message triggered an event.

This commit is contained in:
akwizgran
2013-12-19 23:06:54 +00:00
parent 0a61fc40ae
commit 93151ee77b
2 changed files with 5 additions and 2 deletions

View File

@@ -239,7 +239,9 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
reloadContact(((ContactRemovedEvent) e).getContactId());
} else if(e instanceof MessageAddedEvent) {
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
reloadContact(((MessageAddedEvent) e).getContactId());
ContactId source = ((MessageAddedEvent) e).getContactId();
if(source == null) loadContacts();
else reloadContact(source);
} else if(e instanceof MessageExpiredEvent) {
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
loadContacts();

View File

@@ -201,7 +201,8 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
});
}
} else if(e instanceof MessageAddedEvent) {
if(((MessageAddedEvent) e).getContactId().equals(contactId)) {
ContactId source = ((MessageAddedEvent) e).getContactId();
if(source == null || source.equals(contactId)) {
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
loadHeaders();
}