don’t crash when long pressing invalid geo-uris

This commit is contained in:
Daniel Gultsch 2019-12-30 00:23:44 +01:00
parent af3c106dc8
commit 42d69fd5e3
1 changed files with 7 additions and 3 deletions

View File

@ -125,9 +125,13 @@ public class GeoHelper {
} }
public static boolean openInOsmAnd(Context context, Message message) { public static boolean openInOsmAnd(Context context, Message message) {
try {
final GeoPoint geoPoint = parseGeoPoint(message.getBody()); final GeoPoint geoPoint = parseGeoPoint(message.getBody());
final String label = getLabel(context, message); final String label = getLabel(context, message);
return geoIntent(geoPoint, label).resolveActivity(context.getPackageManager()) != null; return geoIntent(geoPoint, label).resolveActivity(context.getPackageManager()) != null;
} catch (IllegalArgumentException e) {
return false;
}
} }
private static String getLabel(Context context, Message message) { private static String getLabel(Context context, Message message) {