From e09c4931810c062f15da24355343fa253e483f47 Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 19 Apr 2015 09:42:04 +0200 Subject: fix #4895: NPE in DistanceDrawer --- main/src/cgeo/geocaching/maps/DistanceDrawer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'main') diff --git a/main/src/cgeo/geocaching/maps/DistanceDrawer.java b/main/src/cgeo/geocaching/maps/DistanceDrawer.java index f2d11bb..9dde8e6 100644 --- a/main/src/cgeo/geocaching/maps/DistanceDrawer.java +++ b/main/src/cgeo/geocaching/maps/DistanceDrawer.java @@ -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; } -- cgit v1.1