aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-04-19 09:42:04 +0200
committerBananeweizen <bananeweizen@gmx.de>2015-04-19 09:42:04 +0200
commite09c4931810c062f15da24355343fa253e483f47 (patch)
tree2d0b37d74888fbdf8d0743920a0655958dd9835d
parent840cc5770d0990c6b7f2219edeb3568ff1e34f10 (diff)
downloadcgeo-e09c4931810c062f15da24355343fa253e483f47.zip
cgeo-e09c4931810c062f15da24355343fa253e483f47.tar.gz
cgeo-e09c4931810c062f15da24355343fa253e483f47.tar.bz2
fix #4895: NPE in DistanceDrawer
-rw-r--r--main/src/cgeo/geocaching/maps/DistanceDrawer.java7
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;
}