Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 9337)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 9338)
@@ -241,10 +241,4 @@
                                     / (trkPnt.time - oldWp.time);
                             velocities.add(vel);
-                            if (vel > maxval) {
-                                maxval = vel;
-                            }
-                            if (vel < minval) {
-                                minval = vel;
-                            }
                         }
                         oldWp = trkPnt;
@@ -252,9 +246,9 @@
                 }
                 Collections.sort(velocities);
-                minval = velocities.get(velocities.size() / 20); // 5% percentile to remove outliers
-                maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile to remove outliers
-                if (minval >= maxval) {
+                if (velocities.isEmpty()) {
                     velocityScale.setRange(0, 120/3.6);
                 } else {
+                    minval = velocities.get(velocities.size() / 20); // 5% percentile to remove outliers
+                    maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile to remove outliers
                     velocityScale.setRange(minval, maxval);
                 }
