File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
app/src/main/java/fr/free/nrw/commons/nearby/fragments Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,7 @@ public void updateMapToTrackPosition(LatLng curLatLng) {
315315 */
316316 @ Override
317317 public void addCurrentLocationMarker (LatLng curLatLng ) {
318+ removeCurrentLocationMarker ();
318319 Timber .d ("Adds current location marker" );
319320
320321 Icon icon = IconFactory .getInstance (getContext ()).fromResource (R .drawable .current_location_marker );
@@ -336,8 +337,10 @@ public void addCurrentLocationMarker(LatLng curLatLng) {
336337
337338 @ Override
338339 public void removeCurrentLocationMarker () {
339- mapboxMap .removeMarker (currentLocationMarker );
340- mapboxMap .removePolygon (currentLocationPolygon );
340+ if (currentLocationMarker != null ) {
341+ mapboxMap .removeMarker (currentLocationMarker );
342+ mapboxMap .removePolygon (currentLocationPolygon );
343+ }
341344 }
342345
343346 /**
Original file line number Diff line number Diff line change @@ -842,7 +842,6 @@ public void enableFABRecenter() {
842842
843843 @ Override
844844 public void recenterMap (fr .free .nrw .commons .location .LatLng curLatLng ) {
845- nearbyMapFragment .removeCurrentLocationMarker ();
846845 nearbyMapFragment .addCurrentLocationMarker (curLatLng );
847846 CameraPosition position ;
848847
You can’t perform that action at this time.
0 commit comments