From d9eaf0ad2389c46c571dc636f06edc0a5abe850b Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Tue, 22 Dec 2015 13:23:18 -0500 Subject: [PATCH] Crashlytics #4 --- .../src/main/java/com/moez/QKSMS/transaction/SmsHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/QKSMS/src/main/java/com/moez/QKSMS/transaction/SmsHelper.java b/QKSMS/src/main/java/com/moez/QKSMS/transaction/SmsHelper.java index 60113467..78ddb2bb 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/transaction/SmsHelper.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/transaction/SmsHelper.java @@ -458,7 +458,10 @@ public class SmsHelper { do { Uri threadUri = Uri.withAppendedPath(Message.MMS_SMS_CONTENT_PROVIDER, conversationCursor.getString(Conversation.ID)); Cursor messageCursor = context.getContentResolver().query(threadUri, MessageColumns.PROJECTION, SmsHelper.UNREAD_SELECTION, null, SmsHelper.sortDateDesc); - result += messageCursor.getCount(); + if (messageCursor != null) { + result += messageCursor.getCount(); + messageCursor.close(); + } } while (conversationCursor.moveToNext()); }