summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Mok <kmok@cyngn.com>2016-07-15 08:28:19 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-07-16 13:09:11 -0700
commite3e5b99695fb79af2f1942fae925f42b70de0134 (patch)
treeaa8dacad38f47676580ea73547e6b09fab607ac6
parentcce9f2766b175bdaaab5a995693a2b90fd347031 (diff)
downloadandroid_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.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();
}
}