Changeset 10106 in josm for trunk/src


Ignore:
Timestamp:
2016-04-03T16:22:18+02:00 (9 years ago)
Author:
Don-vip
Message:

fix coverity 1353523 + 1347995

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

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

    r10043 r10106  
    230230
    231231    private final transient TaggingPresetHandler presetHandler = new TaggingPresetHandler() {
    232         @Override public void updateTags(List<Tag> tags) {
     232        @Override
     233        public void updateTags(List<Tag> tags) {
    233234            Command command = TaggingPreset.createCommand(getSelection(), tags);
    234             if (command != null) Main.main.undoRedo.add(command);
    235         }
    236 
    237         @Override public Collection<OsmPrimitive> getSelection() {
    238             if (Main.main == null) return null;
    239             return Main.main.getInProgressSelection();
     235            if (command != null) {
     236                Main.main.undoRedo.add(command);
     237            }
     238        }
     239
     240        @Override
     241        public Collection<OsmPrimitive> getSelection() {
     242            return Main.main == null ? Collections.<OsmPrimitive>emptyList() : Main.main.getInProgressSelection();
    240243        }
    241244    };
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

    r10006 r10106  
    193193    protected static HistoryDataSet loadHistory(OsmServerHistoryReader reader, ProgressMonitor progressMonitor) throws OsmTransferException {
    194194        HistoryDataSet ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false));
    195         // load corresponding changesets (mostly for changeset comment)
    196         OsmServerChangesetReader changesetReader = new OsmServerChangesetReader();
    197         List<Long> changesetIds = new ArrayList<>(ds.getChangesetIds());
    198 
    199         // query changesets 100 by 100 (OSM API limit)
    200         int n = ChangesetQuery.MAX_CHANGESETS_NUMBER;
    201         for (int i = 0; i < changesetIds.size(); i += n) {
    202             for (Changeset c : changesetReader.queryChangesets(
    203                     new ChangesetQuery().forChangesetIds(changesetIds.subList(i, Math.min(i + n, changesetIds.size()))),
    204                     progressMonitor.createSubTaskMonitor(1, false))) {
    205                 ds.putChangeset(c);
     195        if (ds != null) {
     196            // load corresponding changesets (mostly for changeset comment)
     197            OsmServerChangesetReader changesetReader = new OsmServerChangesetReader();
     198            List<Long> changesetIds = new ArrayList<>(ds.getChangesetIds());
     199
     200            // query changesets 100 by 100 (OSM API limit)
     201            int n = ChangesetQuery.MAX_CHANGESETS_NUMBER;
     202            for (int i = 0; i < changesetIds.size(); i += n) {
     203                for (Changeset c : changesetReader.queryChangesets(
     204                        new ChangesetQuery().forChangesetIds(changesetIds.subList(i, Math.min(i + n, changesetIds.size()))),
     205                        progressMonitor.createSubTaskMonitor(1, false))) {
     206                    ds.putChangeset(c);
     207                }
    206208            }
    207209        }
    208 
    209210        return ds;
    210211    }
Note: See TracChangeset for help on using the changeset viewer.