You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/10/19 15:45:41 UTC

cordova-plugin-contacts git commit: CB-9823 Making sure the photoCursor is always closed.

Repository: cordova-plugin-contacts
Updated Branches:
  refs/heads/master 6bbd5a4a8 -> e928b520e


CB-9823 Making sure the photoCursor is always closed.

This closes #61, closes #69


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/e928b520
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/e928b520
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/e928b520

Branch: refs/heads/master
Commit: e928b520eaf70c9128e9c21e36eab107d90729cf
Parents: 6bbd5a4
Author: Gaetan <ga...@gmail.com>
Authored: Mon May 4 15:19:36 2015 +0200
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Oct 19 15:55:21 2015 +0300

----------------------------------------------------------------------
 src/android/ContactAccessorSdk5.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/e928b520/src/android/ContactAccessorSdk5.java
----------------------------------------------------------------------
diff --git a/src/android/ContactAccessorSdk5.java b/src/android/ContactAccessorSdk5.java
index e18045c..2c92634 100644
--- a/src/android/ContactAccessorSdk5.java
+++ b/src/android/ContactAccessorSdk5.java
@@ -935,14 +935,12 @@ public class ContactAccessorSdk5 extends ContactAccessor {
 
             // Query photo existance
             Cursor photoCursor = mApp.getActivity().getContentResolver().query(photoUri, new String[] {ContactsContract.Contacts.Photo.PHOTO}, null, null, null);
-            if (photoCursor == null) {
+            if (photoCursor == null) return null;
+            if (!photoCursor.moveToFirst()) {
+                photoCursor.close();
                 return null;
-            } else {
-                if (!photoCursor.moveToFirst()) {
-                    photoCursor.close();
-                    return null;
-                }
             }
+            photoCursor.close();
         } catch (JSONException e) {
             Log.e(LOG_TAG, e.getMessage(), e);
         } catch (SQLiteException e)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org