Stop Conversations force closing over sqlite errors due to long messages
This commit is contained in:
parent
8a1ebf2bbe
commit
2a34ece571
|
@ -154,6 +154,8 @@ public class Message extends AbstractEntity {
|
|||
}
|
||||
} catch (InvalidJidException e) {
|
||||
jid = null;
|
||||
} catch (IllegalStateException e) {
|
||||
return null; // message too long?
|
||||
}
|
||||
Jid trueCounterpart;
|
||||
try {
|
||||
|
|
|
@ -636,8 +636,10 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
cursor.moveToLast();
|
||||
do {
|
||||
Message message = Message.fromCursor(cursor);
|
||||
message.setConversation(conversation);
|
||||
list.add(message);
|
||||
if (message != null) {
|
||||
message.setConversation(conversation);
|
||||
list.add(message);
|
||||
}
|
||||
} while (cursor.moveToPrevious());
|
||||
}
|
||||
cursor.close();
|
||||
|
|
|
@ -84,6 +84,8 @@ public class ExportLogsService extends Service {
|
|||
BufferedWriter bw = null;
|
||||
try {
|
||||
for (Message message : mDatabaseBackend.getMessagesIterable(conversation)) {
|
||||
if (message == null)
|
||||
continue;
|
||||
if (message.getType() == Message.TYPE_TEXT || message.hasFileOnRemoteHost()) {
|
||||
String date = simpleDateFormat.format(new Date(message.getTimeSent()));
|
||||
if (bw == null) {
|
||||
|
|
Loading…
Reference in a new issue