From 80c7eab9a7060a4f47974d2ff01c9a1fc7e1479a Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 19 Nov 2009 10:34:49 -0800 Subject: [PATCH] ContactManager tweaks; null/empty checks to eliminate NullPointerException. --- framework/src/com/phonegap/ContactManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/framework/src/com/phonegap/ContactManager.java b/framework/src/com/phonegap/ContactManager.java index 12e91424..84f8947b 100644 --- a/framework/src/com/phonegap/ContactManager.java +++ b/framework/src/com/phonegap/ContactManager.java @@ -153,7 +153,7 @@ public class ContactManager { name = cur.getString(nameColumn); phoneNumber = cur.getString(phoneColumn); email_id = cur.getString(emailIdColumn); - if (email_id != null) + if (email_id != null && email_id.length() > 0) email = getEmail(email_id); else email = ""; @@ -250,8 +250,7 @@ public class ContactManager { private String getEmailColumnData(Cursor cur) { String email = ""; - if (cur.moveToFirst()) { - + if (cur != null && cur.moveToFirst()) { int emailColumn = cur.getColumnIndex(ContactMethods.DATA); do { // Get the field values