Changeset 11008 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/LayerPositionStrategy.java
r10717 r11008 55 55 static LayerPositionStrategy inFrontOfFirst(final Predicate<Layer> what) { 56 56 return manager -> { 57 List<Layer> layers = manager.getLayers(); 58 for (int i = 0; i < layers.size(); i++) { 59 if (what.test(layers.get(i))) { 60 return i; 57 if (manager != null) { 58 List<Layer> layers = manager.getLayers(); 59 for (int i = 0; i < layers.size(); i++) { 60 if (what.test(layers.get(i))) { 61 return i; 62 } 61 63 } 64 return layers.size(); 62 65 } 63 return layers.size();66 return 0; 64 67 }; 65 68 } … … 72 75 static LayerPositionStrategy afterLast(final Predicate<Layer> what) { 73 76 return manager -> { 74 List<Layer> layers = manager.getLayers(); 75 for (int i = layers.size() - 1; i >= 0; i--) { 76 if (what.test(layers.get(i))) { 77 return i + 1; 77 if (manager != null) { 78 List<Layer> layers = manager.getLayers(); 79 for (int i = layers.size() - 1; i >= 0; i--) { 80 if (what.test(layers.get(i))) { 81 return i + 1; 82 } 78 83 } 79 84 }
Note:
See TracChangeset
for help on using the changeset viewer.