From 83d42d070d41a950fb710411c782ff78501b0a45 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Wed, 9 Jul 2014 16:32:33 +0200 Subject: [PATCH] Fix crash when parsing certain locations without coordinates (EFA). --- enabler/src/de/schildbach/pte/AbstractEfaProvider.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java index 5fff1263..0708f08f 100644 --- a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java @@ -2920,14 +2920,16 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider XmlPullUtil.optValueTag(pp, "a", null); final Position position = new Position(XmlPullUtil.optValueTag(pp, "pl", null)); final String place = normalizeLocationName(XmlPullUtil.optValueTag(pp, "pc", null)); - final Point coord = coordStrToPoint(XmlPullUtil.valueTag(pp, "c")); + final Point coord = coordStrToPoint(XmlPullUtil.optValueTag(pp, "c", null)); XmlPullUtil.exit(pp, "r"); final Location location; if (id.equals("99999997") || id.equals("99999998")) - location = new Location(LocationType.ADDRESS, null, coord.lat, coord.lon, place, name); + location = new Location(LocationType.ADDRESS, null, coord != null ? coord.lat : 0, coord != null ? coord.lon : 0, + place, name); else - location = new Location(LocationType.STATION, id, coord.lat, coord.lon, place, name); + location = new Location(LocationType.STATION, id, coord != null ? coord.lat : 0, coord != null ? coord.lon : 0, + place, name); XmlPullUtil.exit(pp, "p");