Changeset 2027 in josm for trunk/src/org


Ignore:
Timestamp:
2009-09-02T21:51:49+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3372: NPE when removing two ways from a relation via properties dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r2018 r2027  
    306306    void membershipEdit(int row) {
    307307        Relation relation = (Relation)membershipData.getValueAt(row, 0);
    308         Main.main.map.relationListDialog.selectRelation(relation);
     308        Main.map.relationListDialog.selectRelation(relation);
    309309        RelationEditor.getEditor(
    310310                Main.map.mapView.getEditLayer(),
     
    474474                            c.setFont(c.getFont().deriveFont(Font.ITALIC));
    475475                        } else {
    476                             final Map.Entry entry = (Map.Entry) v.entrySet().iterator().next(); 
     476                            final Map.Entry entry = (Map.Entry) v.entrySet().iterator().next();
    477477                            str = (String) entry.getKey();
    478478                        }
     
    751751        if (Main.main.getCurrentDataSet() != null) {
    752752            for (Relation r : Main.main.getCurrentDataSet().relations) {
    753                 if (!r.deleted && !r.incomplete) {
     753                if (!r.isDeleted() && !r.incomplete) {
    754754                    for (RelationMember m : r.getMembers()) {
    755755                        if (newSelection.contains(m.getMember())) {
     
    842842            Relation rel = new Relation(cur);
    843843            Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected();
    844             int index = 0;
    845             for (RelationMember rm : cur.getMembers()) {
    846                 for (OsmPrimitive osm : sel) {
    847                     if (rm.getMember() == osm)
    848                     {
    849                         rel.removeMember(index);
    850                         break;
    851                     }
    852                 }
    853                 index++;
     844            for (OsmPrimitive primitive: sel) {
     845                rel.removeMembersFor(primitive);
    854846            }
    855847            Main.main.undoRedo.add(new ChangeCommand(cur, rel));
Note: See TracChangeset for help on using the changeset viewer.