From 7825e5bb495effebea926bf59b969a1344c842ca Mon Sep 17 00:00:00 2001 From: srowen Date: Fri, 27 Apr 2012 11:17:11 +0000 Subject: [PATCH] Avoid another possible NPE. Adjust obfuscation to produce less ambiguous mappings git-svn-id: https://zxing.googlecode.com/svn/trunk@2272 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- android/proguard.cfg | 3 +++ .../zxing/client/android/share/ShareActivity.java | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/android/proguard.cfg b/android/proguard.cfg index 15b6674c8..780b09b86 100644 --- a/android/proguard.cfg +++ b/android/proguard.cfg @@ -2,6 +2,9 @@ -dontskipnonpubliclibraryclasses -verbose +# Added: +-useuniqueclassmembernames + -dontpreverify -optimizations !class/merging/* diff --git a/android/src/com/google/zxing/client/android/share/ShareActivity.java b/android/src/com/google/zxing/client/android/share/ShareActivity.java index 7e7f4e2b2..1aa446212 100755 --- a/android/src/com/google/zxing/client/android/share/ShareActivity.java +++ b/android/src/com/google/zxing/client/android/share/ShareActivity.java @@ -231,7 +231,9 @@ public final class ShareActivity extends Activity { int phonesNumberColumn = phonesCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER); while (phonesCursor.moveToNext() && foundPhone < Contents.PHONE_KEYS.length) { String number = phonesCursor.getString(phonesNumberColumn); - bundle.putString(Contents.PHONE_KEYS[foundPhone], massageContactData(number)); + if (number != null && number.length() > 0) { + bundle.putString(Contents.PHONE_KEYS[foundPhone], massageContactData(number)); + } foundPhone++; } } finally { @@ -250,7 +252,9 @@ public final class ShareActivity extends Activity { if (methodsCursor.moveToNext()) { String data = methodsCursor.getString( methodsCursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS)); - bundle.putString(ContactsContract.Intents.Insert.POSTAL, massageContactData(data)); + if (data != null && data.length() > 0) { + bundle.putString(ContactsContract.Intents.Insert.POSTAL, massageContactData(data)); + } } } finally { methodsCursor.close(); @@ -268,7 +272,9 @@ public final class ShareActivity extends Activity { int emailColumn = emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA); while (emailCursor.moveToNext() && foundEmail < Contents.EMAIL_KEYS.length) { String email = emailCursor.getString(emailColumn); - bundle.putString(Contents.EMAIL_KEYS[foundEmail], massageContactData(email)); + if (email != null && email.length() > 0) { + bundle.putString(Contents.EMAIL_KEYS[foundEmail], massageContactData(email)); + } foundEmail++; } } finally {