mapzen / eraser-map

Privacy-focused mapping application for Android
GNU General Public License v3.0
74 stars 24 forks source link

App crash when 0 search results returned #780

Closed ecgreb closed 7 years ago

ecgreb commented 7 years ago

When search completes successfully but returns 0 results the app crashes with an IndexOutOfBoundsException.

11-09 14:58:58.693 15840-15840/com.mapzen.erasermap E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.mapzen.erasermap, PID: 15840
                                                                      java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
                                                                          at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                                                                          at java.util.ArrayList.get(ArrayList.java:308)
                                                                          at com.mapzen.erasermap.controller.MainActivity.addSearchResultsToMap(MainActivity.kt:720)
                                                                          at com.mapzen.erasermap.controller.MainActivity.showSearchResults(MainActivity.kt:543)
                                                                          at com.mapzen.erasermap.presenter.MainPresenterImpl.onSearchResultsAvailable(MainPresenterImpl.kt:89)
                                                                          at com.mapzen.erasermap.controller.MainActivity$PeliasCallback.success(MainActivity.kt:498)
                                                                          at com.mapzen.erasermap.controller.MainActivity$PeliasCallback.success(MainActivity.kt:493)
                                                                          at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:45)
                                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
ecgreb commented 7 years ago

Additional testing shows this is an issue with the open pull request https://github.com/mapzen/eraser-map/pull/777 and does not occur in master. Moving to a comment there.