Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r18613 r18927 76 76 /** 77 77 * A layer holding markers. 78 * 78 * <p> 79 79 * Markers are GPS points with a name and, optionally, a symbol code attached; 80 80 * marker layers can be created from waypoints when importing raw GPS data, 81 81 * but they may also come from other sources. 82 * 82 * <p> 83 83 * The symbol code is for future use. 84 * 84 * <p> 85 85 * The data is read only. 86 86 */ … … 95 95 private Marker currentMarker; 96 96 public AudioMarker syncAudioMarker; 97 private Color color, realcolor; 97 private Color color; 98 private Color realcolor; 98 99 final int markerSize = new IntegerProperty("draw.rawgps.markers.size", 4).get(); 99 100 final BasicStroke markerStroke = new StrokeProperty("draw.rawgps.markers.stroke", "1").get(); … … 523 524 public List<? extends IImageEntry<?>> getSelection() { 524 525 if (this.currentMarker instanceof ImageMarker) { 525 return Collections.singletonList(((ImageMarker) this.currentMarker).getRemoteEntry()); 526 final RemoteEntry remoteEntry = ((ImageMarker) this.currentMarker).getRemoteEntry(); 527 if (remoteEntry != null) { 528 return Collections.singletonList(remoteEntry); 529 } 526 530 } 527 531 return Collections.emptyList(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
r18870 r18927 7 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 import java.net.MalformedURLException; 10 import java.net.URI; 9 11 import java.util.Collections; 10 12 … … 92 94 } 93 95 } 96 97 /** 98 * Ensure that if a file is unable to be read, we return an empty list instead of a list with {@code null} in it. 99 */ 100 @Test 101 void testNonRegression23316() throws MalformedURLException { 102 MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null); 103 layer.setCurrentMarker(new ImageMarker(LatLon.ZERO, URI.create("file:/not_a_real_file_123456789.jpg").toURL(), 104 layer, 0, 0)); 105 assertEquals(Collections.emptyList(), layer.getSelection()); 106 } 94 107 }
Note:
See TracChangeset
for help on using the changeset viewer.