Skip to content

Commit

Permalink
fix(android): add null checks for map in MapView
Browse files Browse the repository at this point in the history
Resolves #4074
  • Loading branch information
monholm committed Mar 14, 2022
1 parent 3338a96 commit 585d89e
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -395,7 +395,7 @@ public void onCameraIdle() {
lifecycleListener = new LifecycleEventListener() {
@Override
public void onHostResume() {
if (hasPermissions()) {
if (hasPermissions() && map != null) {
//noinspection MissingPermission
map.setMyLocationEnabled(showUserLocation);
map.setLocationSource(fusedLocationSource);
Expand All @@ -410,7 +410,7 @@ public void onHostResume() {

@Override
public void onHostPause() {
if (hasPermissions()) {
if (hasPermissions() && map != null) {
//noinspection MissingPermission
map.setMyLocationEnabled(false);
}
Expand Down Expand Up @@ -1011,7 +1011,9 @@ public boolean dispatchTouchEvent(MotionEvent ev) {

int X = (int)ev.getX();
int Y = (int)ev.getY();
tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
if(map != null) {
tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
}

int action = MotionEventCompat.getActionMasked(ev);

Expand Down

0 comments on commit 585d89e

Please sign in to comment.