Permalink
Browse files

Guard against a few rare errors from Play logs

  • Loading branch information...
srowen committed Nov 2, 2017
1 parent 49d90b6 commit 7eae23f65951d3aa4272528964cbbd000d103286
@@ -122,13 +122,15 @@ public void handleMessage(Message message) {
}
// Needed for default Android browser / Chrome only apparently
switch (browserPackageName) {
case "com.android.browser":
case "com.android.chrome":
intent.setPackage(browserPackageName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
break;
if (browserPackageName != null) {
switch (browserPackageName) {
case "com.android.browser":
case "com.android.chrome":
intent.setPackage(browserPackageName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
break;
}
}
try {
@@ -201,7 +201,7 @@ final void addContact(String[] names,
// Only use the first name in the array, if present.
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, ContactsContract.Contacts.CONTENT_URI);
intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
putExtra(intent, ContactsContract.Intents.Insert.NAME, names != null ? names[0] : null);
putExtra(intent, ContactsContract.Intents.Insert.NAME, names != null && names.length > 0 ? names[0] : null);
putExtra(intent, ContactsContract.Intents.Insert.PHONETIC_NAME, pronunciation);
@@ -270,7 +270,7 @@ final void addContact(String[] names,
if (note != null) {
aggregatedNotes.append('\n').append(note);
}
if (geo != null) {
if (geo != null && geo.length >= 2) {
aggregatedNotes.append('\n').append(geo[0]).append(',').append(geo[1]);
}
@@ -196,7 +196,11 @@ public AddressBookParsedResult parse(Result result) {
if ("uri".equals(valueType)) {
// Don't actually support dereferencing URIs, but use scheme-specific part not URI
// as value, to support tel: and mailto:
element = URI.create(element).getSchemeSpecificPart();
try {
element = URI.create(element).getSchemeSpecificPart();
} catch (IllegalArgumentException iae) {
// ignore
}
}
if (metadata == null) {
List<String> match = new ArrayList<>(1);

0 comments on commit 7eae23f

Please sign in to comment.