Merge pull request #14898 from mapbox/tvn-allow-null-updates

Allow null updates to GeoJsonSource#setGeoJson
This commit is contained in:
Tobrun
2019-06-11 19:14:21 +02:00
committed by GitHub
parent 314032d814
commit e3d87ed826

View File

@@ -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 {