Index: applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java
===================================================================
--- applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java	(revision 34927)
+++ applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java	(revision 34928)
@@ -305,6 +305,5 @@
 
         if (wp1 != null && wp2 != null) {
-            long diff = wp2.getDate().getTime() - wp1.getDate().getTime();
-            return diff;
+            return wp2.getDate().getTime() - wp1.getDate().getTime();
         }
 
@@ -378,10 +377,15 @@
     @Override
     public void visitWayPoint(WayPoint wp) {
-        if (wp.getDate().after(end)) {
-            setEnd(wp);
-        }
-
-        if (wp.getDate().before(start)) {
-            setStart(wp);
+        if (wp == null)
+            return;
+
+        if (wp.hasDate()) {
+            if (wp.getDate().after(end)) {
+                setEnd(wp);
+            }
+
+            if (wp.getDate().before(start)) {
+                setStart(wp);
+            }
         }
 
