diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/workers/MapillarySequenceDownloader.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/workers/MapillarySequenceDownloader.java index 492a76aba..d5640ad1d 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/workers/MapillarySequenceDownloader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/workers/MapillarySequenceDownloader.java @@ -118,10 +118,11 @@ protected MapillarySequence doInBackground() { private void getImageRange(int i, long[] imagesToGet, long[] images) { int retries = 0; - Map> map = MapillaryDownloader.downloadImages(imagesToGet); + final Map> map = MapillaryDownloader.downloadImages(imagesToGet); while (retries < Config.getPref().getInt("mapillary.image.retries", 10) && (map.size() != 1 || !map.containsKey(this.sequenceKey) || map.get(this.sequenceKey).size() != imagesToGet.length)) { - map = MapillaryDownloader.downloadImages(imagesToGet); + MapillaryDownloader.downloadImages(imagesToGet).forEach( + (key, value) -> map.merge(key, value, (list1, list2) -> list1.size() > list2.size() ? list1 : list2)); retries++; } if (map.size() != 1 || !map.containsKey(this.sequenceKey)) {