EFA: Handle missing message code when querying for locations via JSON.

This commit is contained in:
Andreas Schildbach 2016-01-06 19:10:34 +01:00
parent d12b1abd03
commit 35c82481b5

View file

@ -285,7 +285,9 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
}
else
{
final JSONArray messages = stopFinder.getJSONArray("message");
final JSONArray messages = stopFinder.optJSONArray("message");
if (messages != null)
{
for (int i = 0; i < messages.length(); i++)
{
final JSONObject message = messages.optJSONObject(i);
@ -294,6 +296,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
if ("code".equals(messageName) && !"-8011".equals(messageValue))
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
}
}
final JSONObject points = stopFinder.optJSONObject("points");
if (points != null)