Index: trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java	(revision 14796)
+++ trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java	(revision 14797)
@@ -176,11 +176,13 @@
     }
 
-    private static Double getElevation(WayPoint wp) {
-        String value = wp.getString(GpxConstants.PT_ELE);
-        if (value != null && !value.isEmpty()) {
-            try {
-                return Double.valueOf(value);
-            } catch (NumberFormatException e) {
-                Logging.warn(e);
+    static Double getElevation(WayPoint wp) {
+        if (wp != null) {
+            String value = wp.getString(GpxConstants.PT_ELE);
+            if (value != null && !value.isEmpty()) {
+                try {
+                    return Double.valueOf(value);
+                } catch (NumberFormatException e) {
+                    Logging.warn(e);
+                }
             }
         }
Index: trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java	(revision 14796)
+++ trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java	(revision 14797)
@@ -4,4 +4,5 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
@@ -14,4 +15,5 @@
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.CachedLatLon;
+import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.io.GpxReaderTest;
 import org.openstreetmap.josm.spi.preferences.Config;
@@ -267,3 +269,19 @@
         }
     }
+
+    /**
+     * Unit test of {@link GpxImageCorrelation#getElevation}
+     */
+    @Test
+    public void testGetElevation() {
+        assertNull(GpxImageCorrelation.getElevation(null));
+        WayPoint wp = new WayPoint(LatLon.ZERO);
+        assertNull(GpxImageCorrelation.getElevation(wp));
+        wp.put(GpxConstants.PT_ELE, "");
+        assertNull(GpxImageCorrelation.getElevation(wp));
+        wp.put(GpxConstants.PT_ELE, "not a number");
+        assertNull(GpxImageCorrelation.getElevation(wp));
+        wp.put(GpxConstants.PT_ELE, "150.0");
+        assertEquals(Double.valueOf(150.0d), GpxImageCorrelation.getElevation(wp));
+    }
 }
