[android] null-check nativeMapView in case it's destroyed

This commit is contained in:
Łukasz Paczos
2018-11-05 16:47:59 +01:00
committed by Łukasz Paczos
parent 18b00b95e9
commit 68fd3a2822

View File

@@ -505,7 +505,10 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
* @see Style
*/
public void setStyleUrl(@NonNull String url) {
nativeMapView.setStyleUrl(url);
if (nativeMapView != null) {
// null-checking the nativeMapView as it can be mistakenly called after it's been destroyed
nativeMapView.setStyleUrl(url);
}
}
/**
@@ -541,7 +544,8 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
@Override
protected void onSizeChanged(int width, int height, int oldw, int oldh) {
if (!isInEditMode()) {
if (!isInEditMode() && nativeMapView != null) {
// null-checking the nativeMapView, see #13277
nativeMapView.resizeView(width, height);
}
}