Ticket #17234: 17234.patch

File 17234.patch, 1.5 KB (added by GerdP, 7 years ago)
  • src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java

     
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.plugins.elevation.gpx;
    3 
     3
    44import java.util.ArrayList;
    55import java.util.Date;
    66import java.util.List;
     
    99import org.openstreetmap.josm.data.gpx.WayPoint;
    1010import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
    1111import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
    12 
    1312
     13
    1414/**
    1515 * Base class for an elevation profile. An elevation profile is constructed out
    1616 * of a set of way points. The profile computes min/max/average height from the
     
    377377     */
    378378    @Override
    379379    public void visitWayPoint(WayPoint wp) {
    380         if (wp.getDate().after(end)) {
    381             setEnd(wp);
    382         }
     380        if (wp == null)
     381            return;
     382        if (wp.getDate() != null) {
     383            if (wp.getDate().after(end)) {
     384                setEnd(wp);
     385            }
    383386
    384         if (wp.getDate().before(start)) {
    385             setStart(wp);
     387            if (wp.getDate().before(start)) {
     388                setStart(wp);
     389            }
    386390        }
    387 
    388391        // update boundaries
    389392        if (bounds == null) {
    390393            bounds = new Bounds(wp.getCoor());