cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rkn...@apache.org
Subject cordova-plugin-contacts git commit: CB-11043: Android App crashes while trying to save contact with phone numbers array with deleted values
Date Tue, 12 Apr 2016 18:40:12 GMT
Repository: cordova-plugin-contacts
Updated Branches:
  refs/heads/master 0f8945b91 -> d7dd9378f


CB-11043: Android App crashes while trying to save contact with phone numbers array with deleted
values

 This closes #121


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/d7dd9378
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/d7dd9378
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/d7dd9378

Branch: refs/heads/master
Commit: d7dd9378fd87d4a6689c7fef57a48a9e9c0a23ba
Parents: 0f8945b
Author: Sarangan Rajamanickam <sarajama@microsoft.com>
Authored: Fri Apr 8 17:43:27 2016 -0700
Committer: Richard Knoll <richard.b.knoll@gmail.com>
Committed: Tue Apr 12 11:32:19 2016 -0700

----------------------------------------------------------------------
 README.md                            | 1 -
 src/android/ContactAccessorSdk5.java | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/d7dd9378/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 4928343..c034e17 100644
--- a/README.md
+++ b/README.md
@@ -369,7 +369,6 @@ for details.
     myContact.save(function (contact_obj) {
         var contactObjToModify = contact_obj.clone();
         contact_obj.remove(function(){
-            // Note: Do NOT use delete operator to remove the phone numbers. It will break
in android.
             var phoneNumbers = [contactObjToModify.phoneNumbers[0]];
             contactObjToModify.phoneNumbers = phoneNumbers;
             contactObjToModify.save(function(c_obj){

http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/d7dd9378/src/android/ContactAccessorSdk5.java
----------------------------------------------------------------------
diff --git a/src/android/ContactAccessorSdk5.java b/src/android/ContactAccessorSdk5.java
index f62bf1b..5d052fb 100644
--- a/src/android/ContactAccessorSdk5.java
+++ b/src/android/ContactAccessorSdk5.java
@@ -1701,8 +1701,10 @@ public class ContactAccessorSdk5 extends ContactAccessor {
             phones = contact.getJSONArray("phoneNumbers");
             if (phones != null) {
                 for (int i = 0; i < phones.length(); i++) {
-                    JSONObject phone = (JSONObject) phones.get(i);
-                    insertPhone(ops, phone);
+                    if(!phones.isNull(i)){
+                        JSONObject phone = (JSONObject) phones.get(i);
+                        insertPhone(ops, phone);
+                    }
                 }
             }
         } catch (JSONException e) {


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


Mime
View raw message