Skip to content

Commit

Permalink
Do not attempt to change map view if track is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynovikov committed Feb 4, 2024
1 parent 169934a commit 2d42615
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/mobi/maptrek/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2750,6 +2750,8 @@ public void onTrackView(Track track) {
updateLocationDrawable();
}
BoundingBox box = track.getBoundingBox();
if (box == null)
return;
box.extendBy(0.05);
mMap.animator().animateTo(box);
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/mobi/maptrek/data/Track.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class Track {
private BoundingBox mBox = null;

public BoundingBox getBoundingBox() {
//TODO Honor empty track
if (points.isEmpty())
return null;
if (mBox == null) {
mBox = new BoundingBox();
synchronized (points) {
Expand All @@ -50,7 +51,7 @@ public BoundingBox getBoundingBox() {
return mBox;
}

public class TrackPoint extends GeoPoint {
public static class TrackPoint extends GeoPoint {
public final boolean continuous;
public final float elevation;
public final float speed;
Expand Down

0 comments on commit 2d42615

Please sign in to comment.