Changeset 12091 in josm


Ignore:
Timestamp:
2017-05-09T20:02:36+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #14762 - NPE

Location:
trunk
Files:
2 edited

Legend:

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

    r12064 r12091  
    13011301    public Collection<? extends OsmPrimitive> getPreservedPrimitives() {
    13021302        DataSet ds = getLayerManager().getEditDataSet();
    1303         return ds != null ? ds.getSelected() : null;
     1303        return ds != null ? ds.getSelected() : Collections.emptySet();
    13041304    }
    13051305
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r12023 r12091  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNotNull;
     6import static org.junit.Assert.assertNull;
    67import static org.junit.Assert.assertTrue;
    78
     
    100101        }
    101102    }
     103
     104    /**
     105     * Non regression test case for bug #14762.
     106     */
     107    @Test
     108    public void testTicket14762() {
     109        DrawAction action = new DrawAction();
     110        assertNull(action.getLayerManager().getEditDataSet());
     111        assertEquals(0, action.getPreservedPrimitives().size());
     112    }
    102113}
Note: See TracChangeset for help on using the changeset viewer.