~samwhited/oslp

71861097ec0be66013e76ef6d445ca3cc3f6bb25 — Sam Whited 3 years ago d4477fa
Fix crash when parsing invalid geo URIs
M src/main/java/com/samwhited/opensharelocationplugin/activities/ShowLocationActivity.java => src/main/java/com/samwhited/opensharelocationplugin/activities/ShowLocationActivity.java +6 -3
@@ 108,9 108,12 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi

						final String schemeSpecificPart = geoUri.getSchemeSpecificPart();
						if (schemeSpecificPart != null && !schemeSpecificPart.isEmpty()) {
							final GeoPoint latlong = LocationHelper.parseLatLong(schemeSpecificPart);
							if (latlong != null && !posInQuery) {
								this.loc = latlong;
							try {
								final GeoPoint latlong = LocationHelper.parseLatLong(schemeSpecificPart);
								if (latlong != null && !posInQuery) {
									this.loc = latlong;
								}
							} catch (final NumberFormatException ignored) {
							}
						}
					}

M src/main/java/com/samwhited/opensharelocationplugin/util/LocationHelper.java => src/main/java/com/samwhited/opensharelocationplugin/util/LocationHelper.java +2 -1
@@ 10,8 10,9 @@ public final class LocationHelper {
	 *
	 * @param latlong A string in the form "lat,long"
	 * @return A GeoPoint representing the lat,long string.
	 * @throws NumberFormatException If an invalid lat or long is specified.
	 */
	public static GeoPoint parseLatLong(final String latlong) {
	public static GeoPoint parseLatLong(final String latlong) throws NumberFormatException {
		if (latlong == null || latlong.isEmpty()) {
			return null;
		}