Index: trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 511)
+++ trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 512)
@@ -254,4 +254,6 @@
 			for (Collection<WayPoint> segment : trk.trackSegs) {
 				for (WayPoint trkPnt : segment) {
+					if (Double.isNaN(trkPnt.latlon.lat()) || Double.isNaN(trkPnt.latlon.lon()))
+						continue;
 					Point screen = mv.getPoint(trkPnt.eastNorth);
 					if (lines && old != null) {
Index: trunk/src/org/openstreetmap/josm/io/GpxReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 511)
+++ trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 512)
@@ -66,4 +66,18 @@
 		}		
 
+		private double parseCoord(String s) {
+			try {
+				return Double.parseDouble(s);
+			} catch (NumberFormatException ex) {
+				return Double.NaN;
+			}
+		}
+
+		private LatLon parseLatLon(Attributes atts) {
+			return new LatLon(
+				parseCoord(atts.getValue("lat")),
+				parseCoord(atts.getValue("lon")));
+		}
+
 		@Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
 			switch(currentState) {
@@ -73,8 +87,7 @@
 					currentState = state.metadata;
 				} else if (qName.equals("wpt")) {
-					LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));
 					states.push(currentState);
 					currentState = state.wpt;
-					currentWayPoint = new WayPoint(ll);
+					currentWayPoint = new WayPoint(parseLatLon(atts));
 				} else if (qName.equals("rte")) {
 					states.push(currentState);
@@ -122,8 +135,7 @@
 			case trkseg:
 				if (qName.equals("trkpt")) {
-					LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));
 					states.push(currentState);
 					currentState = state.wpt;
-					currentWayPoint = new WayPoint(ll);
+					currentWayPoint = new WayPoint(parseLatLon(atts));
 				}
 				break;
@@ -144,8 +156,7 @@
 					currentLink = new GpxLink(atts.getValue("href"));
 				} else if (qName.equals("rtept")) {
-					LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));
 					states.push(currentState);
 					currentState = state.wpt;
-					currentWayPoint = new WayPoint(ll);
+					currentWayPoint = new WayPoint(parseLatLon(atts));
 				} else if (qName.equals("extensions")) {
 					states.push(currentState);
@@ -198,4 +209,8 @@
 					currentLink.type = accumulator.toString();
 				} else if (qName.equals("link")) {
+					// <link>URL</link>
+					if (currentLink.uri == null)
+						currentLink.uri = accumulator.toString();
+
 					currentState = states.pop();
 				}
