hanneseilers / Mensa-SH

Android app for all cafertias of Studentenwerk Schleswig-Holstein.
Apache License 2.0
2 stars 1 forks source link

IndexOutOfBoundsException #11

Closed hanneseilers closed 10 years ago

hanneseilers commented 10 years ago

I get this exception on startup. Maybe there you're selecting a item that before it is drawn or you need to synchronize several threads?

FATAL EXCEPTION: main java.lang.IndexOutOfBoundsException: Invalid index 7, size is 7 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at de.hanneseilers.mensash.activities.ActivityMain.selectDrawerItem(ActivityMain.java:438) at de.hanneseilers.mensash.loader.AsyncMensenLoader.onPostExecute(AsyncMensenLoader.java:93) at de.hanneseilers.mensash.loader.AsyncMensenLoader.onPostExecute(AsyncMensenLoader.java:1) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method)

hanneseilers commented 10 years ago

Seems this exception occurs only on startup. Fixed it by checking position of item in lists. If the list has no such position take the last available item. Works!