mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
fixed npes
This commit is contained in:
parent
47105a677a
commit
c6f9b23def
@ -139,6 +139,9 @@ public class Conversation extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLatestMarkableMessageId() {
|
public String getLatestMarkableMessageId() {
|
||||||
|
if (this.messages == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
for(int i = this.messages.size() - 1; i >= 0; --i) {
|
for(int i = this.messages.size() - 1; i >= 0; --i) {
|
||||||
if (this.messages.get(i).getStatus() <= Message.STATUS_RECEIVED && this.messages.get(i).markable) {
|
if (this.messages.get(i).getStatus() <= Message.STATUS_RECEIVED && this.messages.get(i).markable) {
|
||||||
if (this.messages.get(i).isRead()) {
|
if (this.messages.get(i).isRead()) {
|
||||||
|
@ -517,7 +517,8 @@ public class XmppConnectionService extends Service {
|
|||||||
MessagePacket packet = null;
|
MessagePacket packet = null;
|
||||||
boolean saveInDb = true;
|
boolean saveInDb = true;
|
||||||
boolean send = false;
|
boolean send = false;
|
||||||
if (account.getStatus() == Account.STATUS_ONLINE) {
|
if (account.getStatus() == Account.STATUS_ONLINE
|
||||||
|
&& account.getXmppConnection() != null) {
|
||||||
if (message.getType() == Message.TYPE_IMAGE) {
|
if (message.getType() == Message.TYPE_IMAGE) {
|
||||||
if (message.getPresence() != null) {
|
if (message.getPresence() != null) {
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||||
@ -567,6 +568,10 @@ public class XmppConnectionService extends Service {
|
|||||||
send = true;
|
send = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!account.getXmppConnection().getFeatures().sm()
|
||||||
|
&& conv.getMode() != Conversation.MODE_MULTI) {
|
||||||
|
message.setStatus(Message.STATUS_SEND);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
message.setStatus(Message.STATUS_WAITING);
|
message.setStatus(Message.STATUS_WAITING);
|
||||||
if (message.getType() == Message.TYPE_TEXT) {
|
if (message.getType() == Message.TYPE_TEXT) {
|
||||||
@ -592,10 +597,6 @@ public class XmppConnectionService extends Service {
|
|||||||
|
|
||||||
}
|
}
|
||||||
conv.getMessages().add(message);
|
conv.getMessages().add(message);
|
||||||
if (!account.getXmppConnection().getFeatures().sm()
|
|
||||||
&& conv.getMode() != Conversation.MODE_MULTI) {
|
|
||||||
message.setStatus(Message.STATUS_SEND);
|
|
||||||
}
|
|
||||||
if (saveInDb) {
|
if (saveInDb) {
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_NONE
|
if (message.getEncryption() == Message.ENCRYPTION_NONE
|
||||||
|| saveEncryptedMessages()) {
|
|| saveEncryptedMessages()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user