summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Mok <kmok@cyngn.com>2016-07-15 08:28:19 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-28 20:43:41 -0700
commit5ae75885eedbdddbe02fcaa0a3b55f69459b4318 (patch)
treec40e64d6fa9c52f0820ae38206fad09899c4da22
parentae1d7338db4091487935051904689915fb2ccf9e (diff)
downloadandroid_packages_apps_Messaging-5ae75885eedbdddbe02fcaa0a3b55f69459b4318.tar.gz
android_packages_apps_Messaging-5ae75885eedbdddbe02fcaa0a3b55f69459b4318.tar.bz2
android_packages_apps_Messaging-5ae75885eedbdddbe02fcaa0a3b55f69459b4318.zip
Messaging: fix cursor not close explicitly
Cursor always need to be close after query. FEIJ-1585 Change-Id: Ie523c89b6271a28d3d2d8a08232387c1bd609880
-rw-r--r--src/com/android/messaging/sms/MmsUtils.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/com/android/messaging/sms/MmsUtils.java b/src/com/android/messaging/sms/MmsUtils.java
index 0728639..339cbb5 100644
--- a/src/com/android/messaging/sms/MmsUtils.java
+++ b/src/com/android/messaging/sms/MmsUtils.java
@@ -1448,10 +1448,10 @@ public class MmsUtils {
final Cursor c = SqliteWrapper.query(context, context.getContentResolver(),
Mms.Inbox.CONTENT_URI, projection, selection,
new String[]{String.valueOf(threadId)}, null);
+ if (c == null) {
+ return;
+ }
try {
- if (c == null || c.getCount() == 0) {
- return;
- }
while (c.moveToNext()) {
Uri uri = ContentUris.withAppendedId(Mms.CONTENT_URI, c.getLong(0));
String from = MmsUtils.getMmsSender(recipients, uri.toString());
@@ -1460,9 +1460,7 @@ public class MmsUtils {
self.getNormalizedDestination(), c.getString(1), status);
}
} finally {
- if (c != null) {
- c.close();
- }
+ c.close();
}
}