EFA: Fix exception when JSON stopfinder doesn't find anything.

This commit is contained in:
Andreas Schildbach 2015-01-12 20:32:14 +01:00
parent 5fc143196e
commit 864783fed0
2 changed files with 10 additions and 1 deletions

View file

@ -277,7 +277,9 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
return new SuggestLocationsResult(header, locations);
}
stops = stopFinder.getJSONArray("points");
stops = stopFinder.optJSONArray("points");
if (stops == null)
return new SuggestLocationsResult(header, locations);
}
final int nStops = stops.length();

View file

@ -80,6 +80,13 @@ public class SydneyProviderLiveTest extends AbstractProviderLiveTest
print(result);
}
@Test
public void suggestLocationsEmpty() throws Exception
{
final SuggestLocationsResult result = provider.suggestLocations("kreide");
print(result);
}
@Test
public void shortTrip() throws Exception
{