Ignore:
Timestamp:
2016-06-24T00:30:42+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13037 - Small fixes for unit tests (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r10452 r10467  
    7474     */
    7575    public synchronized void add(final Command c) {
    76         DataSet ds = Main.getLayerManager().getEditDataSet();
    77         Collection<? extends OsmPrimitive> oldSelection = ds.getSelected();
     76        DataSet ds = c.getAffectedDataSet();
     77        if (ds == null) {
     78            // old, legacy behaviour
     79            ds = Main.getLayerManager().getEditDataSet();
     80        }
     81        Collection<? extends OsmPrimitive> oldSelection = null;
     82        if (ds != null) {
     83            oldSelection = ds.getSelected();
     84        }
    7885        addNoRedraw(c);
    7986        afterAdd();
    8087
    8188        // the command may have changed the selection so tell the listeners about the current situation
    82         fireIfSelectionChanged(ds, oldSelection);
     89        if (ds != null) {
     90            fireIfSelectionChanged(ds, oldSelection);
     91        }
    8392    }
    8493
Note: See TracChangeset for help on using the changeset viewer.