Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 18926)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 18927)
@@ -76,11 +76,11 @@
 /**
  * A layer holding markers.
- *
+ * <p>
  * Markers are GPS points with a name and, optionally, a symbol code attached;
  * marker layers can be created from waypoints when importing raw GPS data,
  * but they may also come from other sources.
- *
+ * <p>
  * The symbol code is for future use.
- *
+ * <p>
  * The data is read only.
  */
@@ -95,5 +95,6 @@
     private Marker currentMarker;
     public AudioMarker syncAudioMarker;
-    private Color color, realcolor;
+    private Color color;
+    private Color realcolor;
     final int markerSize = new IntegerProperty("draw.rawgps.markers.size", 4).get();
     final BasicStroke markerStroke = new StrokeProperty("draw.rawgps.markers.stroke", "1").get();
@@ -523,5 +524,8 @@
     public List<? extends IImageEntry<?>> getSelection() {
         if (this.currentMarker instanceof ImageMarker) {
-            return Collections.singletonList(((ImageMarker) this.currentMarker).getRemoteEntry());
+            final RemoteEntry remoteEntry = ((ImageMarker) this.currentMarker).getRemoteEntry();
+            if (remoteEntry != null) {
+                return Collections.singletonList(remoteEntry);
+            }
         }
         return Collections.emptyList();
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java	(revision 18926)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java	(revision 18927)
@@ -7,4 +7,6 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import java.net.MalformedURLException;
+import java.net.URI;
 import java.util.Collections;
 
@@ -92,3 +94,14 @@
         }
     }
+
+    /**
+     * Ensure that if a file is unable to be read, we return an empty list instead of a list with {@code null} in it.
+     */
+    @Test
+    void testNonRegression23316() throws MalformedURLException {
+        MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null);
+        layer.setCurrentMarker(new ImageMarker(LatLon.ZERO, URI.create("file:/not_a_real_file_123456789.jpg").toURL(),
+                layer, 0, 0));
+        assertEquals(Collections.emptyList(), layer.getSelection());
+    }
 }
