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

View file

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