File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
library/src/main/java/com/google/maps/android/clustering/view Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ public void run() {
524524 }
525525
526526 for (final MarkerWithPosition marker : markersToRemove ) {
527- boolean onScreen = visibleBounds .contains (marker .position );
527+ boolean onScreen = marker . position != null && visibleBounds .contains (marker .position );
528528 if (onScreen && mAnimate ) {
529529 final Point point = mSphericalMercatorProjection .toPoint (marker .position );
530530 final Point closest = findClosestCluster (newClustersOnScreen , point );
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ public void run() {
453453 if (DefaultAdvancedMarkersClusterRenderer .this .mClusters != null && mAnimate ) {
454454 existingClustersOnScreen = new ArrayList <>();
455455 for (Cluster <T > c : DefaultAdvancedMarkersClusterRenderer .this .mClusters ) {
456- if (shouldRenderAsCluster (c ) && visibleBounds .contains (c .getPosition ())) {
456+ if (shouldRenderAsCluster (c ) && c . getPosition () != null && visibleBounds .contains (c .getPosition ())) {
457457 Point point = mSphericalMercatorProjection .toPoint (c .getPosition ());
458458 existingClustersOnScreen .add (point );
459459 }
@@ -492,7 +492,7 @@ public void run() {
492492 if (mAnimate ) {
493493 newClustersOnScreen = new ArrayList <>();
494494 for (Cluster <T > c : clusters ) {
495- if (shouldRenderAsCluster (c ) && visibleBounds .contains (c .getPosition ())) {
495+ if (shouldRenderAsCluster (c ) && c . getPosition () != null && visibleBounds .contains (c .getPosition ())) {
496496 Point p = mSphericalMercatorProjection .toPoint (c .getPosition ());
497497 newClustersOnScreen .add (p );
498498 }
Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ public void run() {
492492
493493 // Remove the old markers, animating them into clusters if zooming out.
494494 for (final MarkerWithPosition marker : markersToRemove ) {
495- boolean onScreen = visibleBounds .contains (marker .position );
495+ boolean onScreen = marker . position != null && visibleBounds .contains (marker .position );
496496 // Don't animate when zooming out more than 3 zoom levels.
497497 // TODO: drop animation based on speed of device & number of markers to animate.
498498 if (!zoomingIn && zoomDelta > -3 && onScreen && mAnimate ) {
You can’t perform that action at this time.
0 commit comments