Guard against a few rare errors from Play logs

This commit is contained in:
Sean Owen 2017-11-02 11:54:25 +00:00
parent 49d90b6457
commit 7eae23f659
3 changed files with 16 additions and 10 deletions

View file

@ -122,13 +122,15 @@ public final class CaptureActivityHandler extends Handler {
}
// 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 {

View file

@ -201,7 +201,7 @@ public abstract class ResultHandler {
// 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 @@ public abstract class ResultHandler {
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]);
}

View file

@ -196,7 +196,11 @@ public final class VCardResultParser extends ResultParser {
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);