mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Handle case where there are no messages
This commit is contained in:
parent
c4309c9fba
commit
35d176c71e
@ -325,9 +325,12 @@ public class MmsSmsDatabase extends Database {
|
||||
String selection = MmsSmsColumns.THREAD_ID + " = " + threadId;
|
||||
|
||||
try (Cursor cursor = queryTables(PROJECTION, selection, order, "1")) {
|
||||
cursor.moveToFirst();
|
||||
return cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.NORMALIZED_DATE_SENT));
|
||||
if (cursor.moveToFirst()) {
|
||||
return cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.NORMALIZED_DATE_SENT));
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Cursor getUnread() {
|
||||
|
@ -939,7 +939,9 @@ public class ThreadDatabase extends Database {
|
||||
if (count > 0) {
|
||||
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
|
||||
long messageTimestamp = mmsSmsDatabase.getLastMessageTimestamp(threadId);
|
||||
lastMessage = mmsSmsDatabase.getMessageForTimestamp(messageTimestamp);
|
||||
if (messageTimestamp > 0) {
|
||||
lastMessage = mmsSmsDatabase.getMessageForTimestamp(messageTimestamp);
|
||||
}
|
||||
}
|
||||
|
||||
return new ThreadRecord(body, snippetUri, lastMessage, recipient, date, count,
|
||||
|
Loading…
Reference in New Issue
Block a user