mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 20:52:21 -05:00
Merge pull request #2270 from moparisthebest/master
Stop Conversations force closing over sqlite errors due to long messages
This commit is contained in:
commit
6313c3c92e
@ -154,6 +154,8 @@ public class Message extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
jid = null;
|
jid = null;
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
return null; // message too long?
|
||||||
}
|
}
|
||||||
Jid trueCounterpart;
|
Jid trueCounterpart;
|
||||||
try {
|
try {
|
||||||
|
@ -640,8 +640,10 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
cursor.moveToLast();
|
cursor.moveToLast();
|
||||||
do {
|
do {
|
||||||
Message message = Message.fromCursor(cursor);
|
Message message = Message.fromCursor(cursor);
|
||||||
message.setConversation(conversation);
|
if (message != null) {
|
||||||
list.add(message);
|
message.setConversation(conversation);
|
||||||
|
list.add(message);
|
||||||
|
}
|
||||||
} while (cursor.moveToPrevious());
|
} while (cursor.moveToPrevious());
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
@ -84,6 +84,8 @@ public class ExportLogsService extends Service {
|
|||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
try {
|
try {
|
||||||
for (Message message : mDatabaseBackend.getMessagesIterable(conversation)) {
|
for (Message message : mDatabaseBackend.getMessagesIterable(conversation)) {
|
||||||
|
if (message == null)
|
||||||
|
continue;
|
||||||
if (message.getType() == Message.TYPE_TEXT || message.hasFileOnRemoteHost()) {
|
if (message.getType() == Message.TYPE_TEXT || message.hasFileOnRemoteHost()) {
|
||||||
String date = simpleDateFormat.format(new Date(message.getTimeSent()));
|
String date = simpleDateFormat.format(new Date(message.getTimeSent()));
|
||||||
if (bw == null) {
|
if (bw == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user