diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2019-06-11 19:14:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-11 19:14:21 +0200 |
commit | e3d87ed826ef81a68853dc4068835915102fd33a (patch) | |
tree | 2f5e64c7f7b8d3acf1cef9807e7d8b36cbebc0f3 | |
parent | 314032d814522ed567c16afa5e64c486d0082c40 (diff) | |
download | qtlocation-mapboxgl-e3d87ed826ef81a68853dc4068835915102fd33a.tar.gz |
Merge pull request #14898 from mapbox/tvn-allow-null-updates
Allow null updates to GeoJsonSource#setGeoJson
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 407ec4aa36..7a54515288 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -4,7 +4,6 @@ import android.support.annotation.Keep; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; - import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; import com.mapbox.geojson.Geometry; @@ -287,14 +286,14 @@ public class GeoJsonSource extends Source { * * @param featureCollection the GeoJSON FeatureCollection */ - public void setGeoJson(FeatureCollection featureCollection) { + public void setGeoJson(@Nullable FeatureCollection featureCollection) { if (detached) { return; } checkThread(); - List<Feature> features = featureCollection.features(); - if (features != null) { + if (featureCollection != null && featureCollection.features() != null) { + List<Feature> features = featureCollection.features(); List<Feature> featuresCopy = new ArrayList<>(features); nativeSetFeatureCollection(FeatureCollection.fromFeatures(featuresCopy)); } else { |