diff options
author | Keith Mok <kmok@cyngn.com> | 2016-07-15 08:28:19 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-07-16 13:09:11 -0700 |
commit | e3e5b99695fb79af2f1942fae925f42b70de0134 (patch) | |
tree | aa8dacad38f47676580ea73547e6b09fab607ac6 | |
parent | cce9f2766b175bdaaab5a995693a2b90fd347031 (diff) | |
download | android_packages_apps_Messaging-e3e5b99695fb79af2f1942fae925f42b70de0134.tar.gz android_packages_apps_Messaging-e3e5b99695fb79af2f1942fae925f42b70de0134.tar.bz2 android_packages_apps_Messaging-e3e5b99695fb79af2f1942fae925f42b70de0134.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.java | 10 |
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(); } } |