<NME> DistanceDrawer.java
<BEF> package cgeo.geocaching.maps;

import cgeo.geocaching.location.Geopoint;

import android.graphics.Canvas;
import android.location.Location;
import android.view.View;

public class DistanceDrawer {
    private final Geopoint destinationCoords;

    private float distance = 0.0f;
    private float realDistance = 0.0f;
    private boolean showBothDistances = false;
    private float routeDistance = 0.0f;

import android.view.WindowManager;

public class DistanceDrawer {
    private Geopoint currentCoords;
    private final Geopoint destinationCoords;

    private Paint paintBox = null;
    }

    public void setCoordinates(final Location location) {
        if (destinationCoords == null || location == null) {
            distance = 0.0f;
        } else {
            distance = new Geopoint(location).distanceTo(destinationCoords);
        }
    }

    public Geopoint getDestinationCoords() {
        return destinationCoords;
    }

    public void setRealDistance(final float realDistance) {
        this.realDistance = realDistance;
    }

    public void setRouteDistance(final float routeDistance) {
        this.routeDistance = routeDistance;
    }

    public void drawDistance(final Canvas canvas) {
        mapDistanceDrawer.drawDistance(showBothDistances, distance, realDistance);
        mapDistanceDrawer.drawRouteDistance(routeDistance);
    }
}
        maxTextWidth = boxWidth - 3 * boxPadding;
    }

    public void setCoordinates(final Location coordinatesIn) {
        currentCoords = new Geopoint(coordinatesIn);

        final float distance = currentCoords.distanceTo(destinationCoords);
        distanceText = Units.getDistanceFromKilometers(distance);
    }

    void drawDistance(final Canvas canvas) {
        if (currentCoords == null) {
            return;
        }


<MSG> fix #4895: NPE in DistanceDrawer
<DFF> @@ -17,7 +17,6 @@ import android.util.DisplayMetrics;
 import android.view.WindowManager;
 
 public class DistanceDrawer {
-    private Geopoint currentCoords;
     private final Geopoint destinationCoords;
 
     private Paint paintBox = null;
@@ -56,15 +55,15 @@ public class DistanceDrawer {
         maxTextWidth = boxWidth - 3 * boxPadding;
     }
 
-    public void setCoordinates(final Location coordinatesIn) {
-        currentCoords = new Geopoint(coordinatesIn);
+    public void setCoordinates(final Location location) {
+        final Geopoint currentCoords = new Geopoint(location);
 
         final float distance = currentCoords.distanceTo(destinationCoords);
         distanceText = Units.getDistanceFromKilometers(distance);
     }
 
     void drawDistance(final Canvas canvas) {
-        if (currentCoords == null) {
+        if (distanceText == null) {
             return;
         }
 

fix #4895: NPE in DistanceDrawer