posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

Tag-Swipe -> MapView -> TagSwipe Crashes on Save #113

Open hallahan opened 8 years ago

hallahan commented 8 years ago

Sometimes if I'm in the tag view, go back to the map view, then go back to the tag view, then save to ODK Collect, the app crashes.

Looking at the log, there is a null pointer exception for OSM Element keys and values. Perhaps the selected OSMElement somehow gets lost in the mix.

hallahan commented 8 years ago

In investigating further, it appears that the actual crash happens when we return to ODK Collect. Perhaps some sort of inconsistency is introduced to the intent's extras?

The MapActivity is finished, and ODK Collect is returned to.

https://github.com/AmericanRedCross/OpenMapKitAndroid/blob/6585d499064745a94bccccc544d9be4a98be34d4/app/src/main/java/org/redcross/openmapkit/MapActivity.java#L667

hallahan commented 8 years ago

After a bit of debugging, I'm not seeing any errors in logcat *:E.

The crash occurs in ODK Collect, though I think OpenMapKit is sending Activity.RESULT_CANCELED to ODK Collect in onActivityResult.

https://github.com/opendatakit/collect/blob/60aae502fd6cc8877576ff69f6742c489d85b82f/collect_app/src/main/java/org/odk/collect/android/activities/FormEntryActivity.java#L574

This is strange, because we explicitly set Activity.RESULT_OK ever time, including if the user goes back and forth between TagSwipe.

https://github.com/AmericanRedCross/OpenMapKitAndroid/blob/c107c89f48065c1fab93790257f8f997be2cee35/app/src/main/java/org/redcross/openmapkit/MapActivity.java#L691

My only guess is that there is some error (though it's not getting logged in logcat?) that is popping both TagSwipe and MapActivity off the stack outside of this line of code?