Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] null-check nativeMapView in case it's destroyed
Browse files Browse the repository at this point in the history
(cherry picked from commit 68fd3a2)
  • Loading branch information
LukasPaczos committed Nov 6, 2018
1 parent cbe14ae commit afe7e8d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,10 @@ public void onLowMemory() {
* @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);
}
}

/**
Expand Down Expand Up @@ -606,7 +609,8 @@ private void setOfflineGeometryRegionDefinition(OfflineGeometryRegionDefinition

@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);
}
}
Expand Down

0 comments on commit afe7e8d

Please sign in to comment.