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.
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
withvar 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.