legendaryfox/bamft — Issue #9: App crashes on opening Map View after cache update
Author: susanafong
Created: 2012-02-14 03:08:38+00:00
State: open

If Map View is selected from the main menu right after the cache has been updated (i.e. when the Toast pops up saying that the cache has been updated), the app will crash. Stack trace as follows:

02-13 22:03:43.529: E/AndroidRuntime(13350): FATAL EXCEPTION: main
02-13 22:03:43.529: E/AndroidRuntime(13350): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ksj.bamft/com.ksj.bamft.activity.OpenTrucksMapActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2781)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread.access$2300(ActivityThread.java:135)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.os.Looper.loop(Looper.java:143)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread.main(ActivityThread.java:4914)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at java.lang.reflect.Method.invokeNative(Native Method)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at java.lang.reflect.Method.invoke(Method.java:521)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at dalvik.system.NativeStart.main(Native Method)
02-13 22:03:43.529: E/AndroidRuntime(13350): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.ksj.bamft.database.DatabaseHandler.getLandmark(DatabaseHandler.java:406)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.ksj.bamft.activity.OpenTrucksMapActivity.getOverlayItemFromSchedule(OpenTrucksMapActivity.java:145)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.ksj.bamft.activity.OpenTrucksMapActivity.showOpenTruckOverlays(OpenTrucksMapActivity.java:100)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.ksj.bamft.activity.OpenTrucksMapActivity.createOpenTrucksMapView(OpenTrucksMapActivity.java:56)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at com.ksj.bamft.activity.OpenTrucksMapActivity.onCreate(OpenTrucksMapActivity.java:39)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1065)
02-13 22:03:43.529: E/AndroidRuntime(13350):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)