Changeset 35228 in osm for applications


Ignore:
Timestamp:
2019-11-12T23:16:38+01:00 (5 years ago)
Author:
donvip
Message:

fix #josm18314 - NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java

    r34522 r35228  
    121121     */
    122122    public void addTagsToOSM(IndoorObject object) {
    123 
    124         if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() &&
    125                 !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) {
    126             List<Tag> tags = this.getObjectTags(object);
    127 
    128             //Increment the counter for the presets
    129             this.counter.count(object);
    130 
    131             //Add the tags to the current selection
    132             for (Tag t : tags) {
    133                 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(
    134                         OsmDataManager.getInstance().getInProgressSelection(), t.getKey(), t.getValue()));
    135             }
    136         //If the selected dataset ist empty
    137         } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    138             JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
     123        DataSet editDataSet = MainApplication.getLayerManager().getEditDataSet();
     124        if (editDataSet != null) {
     125            Collection<OsmPrimitive> selection = OsmDataManager.getInstance().getInProgressSelection();
     126            if (!editDataSet.selectionEmpty() && !selection.isEmpty()) {
     127                List<Tag> tags = this.getObjectTags(object);
     128
     129                //Increment the counter for the presets
     130                this.counter.count(object);
     131
     132                //Add the tags to the current selection
     133                for (Tag t : tags) {
     134                    UndoRedoHandler.getInstance().add(new ChangePropertyCommand(selection, t.getKey(), t.getValue()));
     135                }
     136            //If the selected dataset ist empty
     137            } else if (editDataSet.selectionEmpty()) {
     138                JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
     139            }
    139140        }
    140141    }
Note: See TracChangeset for help on using the changeset viewer.