From 92422a939a33b0a4d57faf1b5a8b99035df18f03 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 28 Sep 2015 16:39:39 -0700 Subject: [PATCH] trim threads in the right direction Closes #4143 // FREEBIE --- src/org/thoughtcrime/securesms/database/ThreadDatabase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java index db9bd21b7d..1a99d950af 100644 --- a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -198,9 +198,9 @@ public class ThreadDatabase extends Database { try { cursor = DatabaseFactory.getMmsSmsDatabase(context).getConversation(threadId); - if (cursor != null && cursor.getCount() > length) { + if (cursor != null && length > 0 && cursor.getCount() > length) { Log.w("ThreadDatabase", "Cursor count is greater than length!"); - cursor.moveToPosition(cursor.getCount() - length); + cursor.moveToPosition(length - 1); long lastTweetDate = cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.NORMALIZED_DATE_RECEIVED));