diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2015-04-19 09:42:04 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2015-04-19 09:42:04 +0200 |
commit | e09c4931810c062f15da24355343fa253e483f47 (patch) | |
tree | 2d0b37d74888fbdf8d0743920a0655958dd9835d | |
parent | 840cc5770d0990c6b7f2219edeb3568ff1e34f10 (diff) | |
download | cgeo-e09c4931810c062f15da24355343fa253e483f47.zip cgeo-e09c4931810c062f15da24355343fa253e483f47.tar.gz cgeo-e09c4931810c062f15da24355343fa253e483f47.tar.bz2 |
fix #4895: NPE in DistanceDrawer
-rw-r--r-- | main/src/cgeo/geocaching/maps/DistanceDrawer.java | 7 |
1 files changed, 3 insertions, 4 deletions
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; } |