Index: /trunk/build.xml
===================================================================
--- /trunk/build.xml	(revision 18818)
+++ /trunk/build.xml	(revision 18819)
@@ -188,5 +188,4 @@
                 <!-- Indicate that this jar may have version specific classes. Only used in Java9+. -->
                 <attribute name="Multi-Release" value="true"/>
-                <attribute name="Automatic-Module-Name" value="org.openstreetmap.josm"/>
             </manifest>
         </jar>
Index: /trunk/src/org/openstreetmap/josm/io/GpxParser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxParser.java	(revision 18818)
+++ /trunk/src/org/openstreetmap/josm/io/GpxParser.java	(revision 18819)
@@ -638,4 +638,7 @@
                 currentState = states.pop();
                 convertUrlToLink(currentWayPoint.attr);
+                if (!currentWayPoint.isLatLonKnown()) {
+                    throw new SAXException(tr("{0} element does not have valid latitude and/or longitude.", localName));
+                }
                 currentRoute.routePoints.add(currentWayPoint);
                 break;
@@ -643,4 +646,7 @@
                 currentState = states.pop();
                 convertUrlToLink(currentWayPoint.attr);
+                if (!currentWayPoint.isLatLonKnown()) {
+                    throw new SAXException(tr("{0} element does not have valid latitude and/or longitude.", localName));
+                }
                 currentTrackSeg.add(currentWayPoint);
                 break;
@@ -649,4 +655,8 @@
                 convertUrlToLink(currentWayPoint.attr);
                 currentWayPoint.getExtensions().addAll(currentExtensionCollection);
+                if (!currentWayPoint.isLatLonKnown()) {
+                    currentExtensionCollection.clear();
+                    throw new SAXException(tr("{0} element does not have valid latitude and/or longitude.", localName));
+                }
                 data.waypoints.add(currentWayPoint);
                 currentExtensionCollection.clear();
Index: /trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(revision 18818)
+++ /trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(revision 18819)
@@ -104,5 +104,9 @@
 
     @ParameterizedTest
-    @ValueSource(strings = "<gpx><wpt></wpt></gpx>")
+    @ValueSource(strings = {
+            "<gpx><wpt></wpt></gpx>",
+            "<gpx><trk><trkseg><trkpt></trkpt></trkseg></trk></gpx>",
+            "<gpx><rte><rtept></rtept></rte></gpx>"
+    })
     void testIncompleteLocations(String gpx) {
         SAXException saxException = assertThrows(SAXException.class,
@@ -111,4 +115,8 @@
         if ("<wpt>".regionMatches(0, gpx, 5, 4)) {
             type = "wpt";
+        } else if ("<trkpt>".regionMatches(0, gpx, 18, 7)) {
+            type = "trkpt";
+        } else if ("<rtept>".regionMatches(0, gpx, 10, 7)) {
+            type = "rtept";
         } else {
             fail("You need to add code to tell us what the exception for \"" + gpx + "\" should be");
