tiemonl / imhungry

imhungry is an Android app to decide where to eat any time, any where
https://imhungry.io/
GNU General Public License v3.0
1 stars 0 forks source link

Maps Activity Sometimes Crashes App #50

Closed TripleFrequency closed 5 years ago

TripleFrequency commented 5 years ago

Basically, when the maps activity launches, if the callback for receiving the user's current location fires before the map is ready, then the app crashes because the map isn't initialized yet.

One way of solving this is replacing the lateinit var map: GoogleMap with var map: GoogleMap? = null, and using null-safe accesses on the map everywhere. This would be a hacky, temporary solution, though.

Another option is to not begin location requests until the onMapReady is called.