summaryrefslogtreecommitdiff
path: root/altoslib/AltosMap.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-06-25 12:23:04 -0700
committerKeith Packard <keithp@keithp.com>2015-06-25 12:23:04 -0700
commit6ecd75a7abb5fcee440f7672082013088634680b (patch)
treee170757eba7e53fa7783c02b7852caec957bdf37 /altoslib/AltosMap.java
parent06908e377b7b932bfe3f6dfc840a0a13340f32ce (diff)
altoslib: Don't crash if dragging a map view without any tiles
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMap.java')
-rw-r--r--altoslib/AltosMap.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java
index 8d12a180..d68cff7a 100644
--- a/altoslib/AltosMap.java
+++ b/altoslib/AltosMap.java
@@ -131,6 +131,10 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
return (System.currentTimeMillis() - user_input_time) < auto_scroll_delay;
}
+ public boolean has_centre() {
+ return centre != null;
+ }
+
public boolean far_from_centre(AltosLatLon lat_lon) {
if (centre == null || transform == null)
@@ -423,8 +427,13 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
}
private void drag_stop(int x, int y) {
- if (!dragged)
+ if (!dragged) {
+ if (transform == null) {
+ debug("Transform not set in stop\n");
+ return;
+ }
map_interface.select_object (transform.screen_lat_lon(new AltosPointInt(x,y)));
+ }
}
private void line_start(int x, int y) {