File tree 2 files changed +5
-3
lines changed
app/src/main/java/fr/free/nrw/commons/nearby/fragments
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) {
315
315
*/
316
316
@ Override
317
317
public void addCurrentLocationMarker (LatLng curLatLng ) {
318
+ removeCurrentLocationMarker ();
318
319
Timber .d ("Adds current location marker" );
319
320
320
321
Icon icon = IconFactory .getInstance (getContext ()).fromResource (R .drawable .current_location_marker );
@@ -336,8 +337,10 @@ public void addCurrentLocationMarker(LatLng curLatLng) {
336
337
337
338
@ Override
338
339
public void removeCurrentLocationMarker () {
339
- mapboxMap .removeMarker (currentLocationMarker );
340
- mapboxMap .removePolygon (currentLocationPolygon );
340
+ if (currentLocationMarker != null ) {
341
+ mapboxMap .removeMarker (currentLocationMarker );
342
+ mapboxMap .removePolygon (currentLocationPolygon );
343
+ }
341
344
}
342
345
343
346
/**
Original file line number Diff line number Diff line change @@ -842,7 +842,6 @@ public void enableFABRecenter() {
842
842
843
843
@ Override
844
844
public void recenterMap (fr .free .nrw .commons .location .LatLng curLatLng ) {
845
- nearbyMapFragment .removeCurrentLocationMarker ();
846
845
nearbyMapFragment .addCurrentLocationMarker (curLatLng );
847
846
CameraPosition position ;
848
847
You can’t perform that action at this time.
0 commit comments