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

fix coverity 1353523 + 1347995

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.