Changeset 13992 in josm for trunk


Ignore:
Timestamp:
2018-06-30T22:40:24+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16443 - add robustness to invalid preferences when loading recent tag collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollection.java

    r13852 r13992  
    1313import org.openstreetmap.josm.data.osm.search.SearchSetting;
    1414import org.openstreetmap.josm.data.preferences.ListProperty;
     15import org.openstreetmap.josm.tools.Logging;
    1516
    1617/**
     
    4748    public void loadFromPreference(ListProperty property) {
    4849        recentTags.clear();
    49         Iterator<String> it = property.get().iterator();
     50        List<String> list = property.get();
     51        Iterator<String> it = list.iterator();
    5052        while (it.hasNext()) {
    5153            String key = it.next();
    52             String value = it.next();
    53             add(new Tag(key, value));
     54            if (it.hasNext()) {
     55                String value = it.next();
     56                add(new Tag(key, value));
     57            } else {
     58                Logging.error("Invalid or incomplete list property: " + list);
     59                break;
     60            }
    5461        }
    5562    }
Note: See TracChangeset for help on using the changeset viewer.