Ignore:
Timestamp:
2023-09-07T18:20:01+02:00 (2 years ago)
Author:
taylor.smock
Message:

Use DeleteCommand.delete where possible and fix some potential NPEs from its usage

Location:
applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/Building.java

    r36132 r36134  
    487487                    addressCmds.add(new ChangeMembersCommand(r, members));
    488488                }
    489                 addressCmds.add(DeleteCommand.delete(Collections.singleton(addrNode)));
     489                final Command deleteCommand = DeleteCommand.delete(Collections.singleton(addrNode));
     490                if (deleteCommand != null) {
     491                    addressCmds.add(deleteCommand);
     492                }
    490493                if (cmdList == null) {
    491494                    Command c = new SequenceCommand(tr("Add address for building"), addressCmds);
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/MergeAddrPointsAction.java

    r35669 r36134  
    3838import org.openstreetmap.josm.tools.Shortcut;
    3939
     40/**
     41 * Merge address points with a building
     42 */
    4043public class MergeAddrPointsAction extends JosmAction {
    4144
     45    /**
     46     * Merge the address point with the building
     47     */
    4248    public MergeAddrPointsAction() {
    4349        super(tr("Merge address points"), "mergeaddr",
     
    173179        }
    174180        if (!replaced.isEmpty()) {
    175             cmds.add(new DeleteCommand(replaced.stream().map(p -> p.a).collect(Collectors.toList())));
     181            final Command deleteCommand = DeleteCommand.delete(replaced.stream().map(p -> p.a).collect(Collectors.toList()));
     182            if (deleteCommand != null) {
     183                cmds.add(deleteCommand);
     184            }
    176185        }
    177186
Note: See TracChangeset for help on using the changeset viewer.