summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2016-03-23 08:55:51 +0100
committerBrad Leege <bleege@gmail.com>2016-03-24 18:48:27 -0500
commitb4d365c3c8d09792b4e7a44e51a4e15d4d08c687 (patch)
tree22426dd13e32a15239015dfdd3e6049ac1d3a5e9
parent48cc510d295162c4d9b0f9e8376db9e05d9ab3e9 (diff)
downloadqtlocation-mapboxgl-b4d365c3c8d09792b4e7a44e51a4e15d4d08c687.tar.gz
[android] #4424 - NativeMapView null pointer bug when updating CompassView
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java12
1 files changed, 12 insertions, 0 deletions
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 9c67096839..883aac10ad 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()) {