don’t crash when long pressing invalid geo-uris
This commit is contained in:
parent
af3c106dc8
commit
42d69fd5e3
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue