opened
stripathi669
username_0
Sometimes while typing the text of the address, I get following error and the app crashes:

    ArrayIndexOutOfBoundsException (@AutocompleteTask:doInBackground:86) {AsyncTask #2}
Array Index Out of bounds Exception
issue
created
stephenbaidu
username_1
Okay, I will look into it.
comment
created
stephenbaidu
username_1
I cannot seem to be able to replicate the error. But I suspect it is as a result of the description not having a comma in it. Hence, below is a fix, please let me know if this works for you.

```
try {
    // Create a JSON object hierarchy from the results
    JSONObject jsonObj = new JSONObject(jsonResults.toString());
    JSONArray predsJsonArray = jsonObj.getJSONArray("predictions");

    // Extract the Place descriptions from the results
    resultList = new ArrayList<PlaceInfo>(predsJsonArray.length());
    for (int i = 0; i < predsJsonArray.length(); i++) {
        JSONObject place = predsJsonArray.getJSONObject(i);
        String id = place.getString("place_id");
        String[] descriptions = place.getString("description").split(", ", 2);
        String name = descriptions[0];
        String description = (descriptions.length > 1)? descriptions[1] : "";

        resultList.add(new PlaceInfo(id, name, description));
    }
} catch (JSONException e) {
    Log.e(LOG_TAG, "Cannot process JSON results", e);
} catch (Exception e) {
    Log.e(LOG_TAG, "Exception", e);
}
```

I also added a generic exception block to prevent the app from crashing in case of other unknown exceptions.
comment
created
stripathi669
username_0
I have done the same thing on my end.

By the way, what other features should I expect in next release on Maven ?
comment
created
stephenbaidu
username_1
Well, I do not really have much in mind. Am still thinking about the request you made #3 though. Feel free to suggest features you would like to see.
comment
created
stripathi669
username_0
One more issue that I could see was that in the search view, the rows didn't wrap the place name if the name length was more than screen's.
comment
created
giorgiobasile
username_2
Hi, I'm importing your library as gradle dependency, but unfortunately you fix in the AutocompleteTask class doesn't appear (I'm talking about the generic Exception catch). Could you please fix it?
comment
created
stephenbaidu
username_1
@username_2 Have been trying to reproduce the error but could not. Just realised I have not pushed the update to jcenter. Will do that soon and sorry for the delay.
comment
created
stephenbaidu
username_1
@username_2 Please use the new version `1.1`. Closing this issue.
comment
closed
stephenbaidu
username_1
issue