Changeset 15096 in josm


Ignore:
Timestamp:
2019-05-19T23:43:25+02:00 (6 years ago)
Author:
Don-vip
Message:

make sure we don't get null style sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r14193 r15096  
    1010import java.util.Map;
    1111import java.util.Map.Entry;
     12import java.util.Objects;
    1213import java.util.Optional;
    1314
     
    499500     */
    500501    void add(StyleSource style) {
    501         styleSources.add(style);
     502        styleSources.add(Objects.requireNonNull(style));
    502503    }
    503504
     
    508509     */
    509510    boolean remove(StyleSource style) {
    510         return styleSources.remove(style);
     511        return styleSources.remove(Objects.requireNonNull(style));
    511512    }
    512513
     
    517518    void setStyleSources(Collection<StyleSource> sources) {
    518519        styleSources.clear();
    519         styleSources.addAll(sources);
     520        sources.forEach(this::add);
    520521    }
    521522
Note: See TracChangeset for help on using the changeset viewer.