android-samples
android-samples copied to clipboard
ApiDemos:Uninitialized mapView in OnMapAndViewReadyListener will cause crash
Please be sure to include as much information as possible:
Environment details
-
Specify the API at the beginning of the title (for example, "Places: ...") ApiDemos
-
OS type and version Android 7
-
Library version and other environment information google_play_services_version '10.2.6'
Steps to reproduce
- Running on Android 7 w/ play services 10.2.6 com.google.android.gms.maps.SupportMapFragment.getView() is nullable. Frequently in this environment the view is NULL here:
https://github.com/googlemaps/android-samples/blob/816f8cc4241ec7c4eaf41b16f7fefcf10ae95faf/ApiDemos/kotlin/app/src/v3/java/com/example/kotlindemos/OnMapAndViewReadyListener.kt#L63
The follow if statement if mapView is NULL will evaluate to true, which will incorrectly setup 'isViewReady'
if (mapView?.width != 0 && mapView?.height != 0) {
// View has already completed layout.
isViewReady = true
}
Code should account for a null mapView to avoid crash.
Thanks! Please feel free to send us a PR for this.
The following PR fixes this issue.
:tada: This issue has been resolved in version 1.6.4 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: