Changeset 17996 in josm for trunk/src/org


Ignore:
Timestamp:
2021-07-11T04:22:04+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #20965 - History browser: fix NPE when restoring deleted tag value (regression from r17773, patch by Bjoeni) + add unit test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/RestorePropertyAction.java

    r17773 r17996  
    66import java.awt.event.ActionEvent;
    77import java.util.Collections;
     8import java.util.HashMap;
    89import java.util.Map;
    910import java.util.function.IntFunction;
    1011import java.util.function.Supplier;
    11 import java.util.stream.Collectors;
    1212
    1313import javax.swing.AbstractAction;
     
    5656
    5757        Map<String, String> changes = TableHelper.selectedIndices(selectionModel).boxed()
    58                 .collect(Collectors.toMap(keyFn::apply, valueFn::apply, (a, b) -> b));
     58                .collect(HashMap::new, (m,i)->m.put(keyFn.apply(i), valueFn.apply(i)), HashMap::putAll);
    5959        ChangePropertyCommand command = new ChangePropertyCommand(Collections.singleton(primitive), changes);
    6060        UndoRedoHandler.getInstance().add(command);
Note: See TracChangeset for help on using the changeset viewer.