From b4d365c3c8d09792b4e7a44e51a4e15d4d08c687 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 23 Mar 2016 08:55:51 +0100 Subject: [PATCH] [android] #4424 - NativeMapView null pointer bug when updating CompassView --- .../main/java/com/mapbox/mapboxsdk/maps/MapView.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 9c6709683..883aac10a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -596,6 +596,10 @@ public class MapView extends FrameLayout { // double getDirection() { + if(mDestroyed){ + return 0; + } + double direction = -mNativeMapView.getBearing(); while (direction > 360) { @@ -1286,6 +1290,10 @@ public class MapView extends FrameLayout { // Must handle window resizing here. @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { + if(mDestroyed){ + return; + } + mNativeMapView.resizeFramebuffer(width, height); } @@ -1293,6 +1301,10 @@ public class MapView extends FrameLayout { // Must sync with UI here @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { + if(mDestroyed){ + return; + } + mCompassView.update(getDirection()); mUserLocationView.update(); for (InfoWindow infoWindow : mMapboxMap.getInfoWindows()) {