OpenTreeMap / otm-android

An OpenTreeMap client for Android. The OpenTreeMap code can be downloaded at https://github.com/OpenTreeMap/otm-core.
Other
23 stars 22 forks source link

Refactor for Asynchronous control flow #298

Closed RobinIsTheBird closed 7 years ago

RobinIsTheBird commented 7 years ago

Rollbar registered the following error:

java.lang.NullPointerException: Attempt to invoke virtual method
'void com.google.android.gms.maps.GoogleMap.moveCamera(
    com.google.android.gms.maps.CameraUpdate)'
on a null object reference

at org.azavea.otm.ui.MainMapFragment.lambda$null$3
    (MainMapFragment.java:488)

It's probably a race condition. Tame the asynchronous control flow to eliminate race conditions.

AFAIK, this fixes all race conditions except open question #1 below. Unknown how many rollbar errors it will eliminate, but should eliminate the original npe.

Refer to

Changes:

Open questions:

  1. Need a way to manage the MapHelper google api dialog to determine whether the play store services problem gets resolved, and fail catastrophically if it doesn't.
  2. Need a way to test missing play store services without wrecking my phone.
  3. Fails to fix # 297, clearing the filter repositions the camera
  4. Probably shouldn't create new Deferred objects if they already exist, but haven't noticed any negative effects of doing so
  5. I don't know enough about the tile cache to be sure when it needs to be cleared.

--

Connects to #294

RobinIsTheBird commented 7 years ago

If this rev passes review, I'll rebase/squash onto master.