Changeset 17357 in josm for trunk/src/org/openstreetmap/josm/data/osm/Way.java
- Timestamp:
- 2020-11-25T11:45:20+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r17103 r17357 31 31 32 32 static final UniqueIdGenerator idGenerator = new UniqueIdGenerator(); 33 private static final Node[] EMPTY_NODES = new Node[0]; 33 34 34 35 /** 35 36 * All way nodes in this way 36 37 */ 37 private Node[] nodes = new Node[0];38 private Node[] nodes = EMPTY_NODES; 38 39 private BBox bbox; 39 40 … … 53 54 } 54 55 55 if (nodes == null) { 56 this.nodes = new Node[0];56 if (nodes == null || nodes.isEmpty()) { 57 this.nodes = EMPTY_NODES; 57 58 } else { 58 this.nodes = nodes.toArray( new Node[0]);59 this.nodes = nodes.toArray(EMPTY_NODES); 59 60 } 60 61 for (Node node: this.nodes) { … … 196 197 /** 197 198 * Constructs a new {@code Way} from an existing {@code Way}. 199 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 198 200 * @param original The original {@code Way} to be identically cloned. Must not be null 199 201 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 212 214 /** 213 215 * Constructs a new {@code Way} from an existing {@code Way}. 216 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 214 217 * @param original The original {@code Way} to be identically cloned. Must not be null 215 218 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 223 226 /** 224 227 * Constructs a new {@code Way} from an existing {@code Way} (including its id). 228 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 225 229 * @param original The original {@code Way} to be identically cloned. Must not be null 226 230 * @since 86
Note:
See TracChangeset
for help on using the changeset viewer.
