Changeset 15385 in josm


Ignore:
Timestamp:
2019-09-29T00:05:29+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18178 - NPE

File:
1 edited

Legend:

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

    r14877 r15385  
    1414import java.util.Collection;
    1515import java.util.List;
     16import java.util.Objects;
    1617
    1718import javax.swing.AbstractAction;
     
    155156    public void layerRemoving(LayerRemoveEvent e) {
    156157        if (e.getRemovedLayer() instanceof NoteLayer) {
    157             noteData.removeNoteDataUpdateListener(this);
    158             noteData = null;
    159             model.clearData();
    160             MapFrame map = MainApplication.getMap();
    161             if (map.mapMode instanceof AddNoteAction) {
    162                 map.selectMapMode(map.mapModeSelect);
     158            NoteData removedNoteData = ((NoteLayer) e.getRemovedLayer()).getNoteData();
     159            removedNoteData.removeNoteDataUpdateListener(this);
     160            if (Objects.equals(noteData, removedNoteData)) {
     161                noteData = null;
     162                model.clearData();
     163                MapFrame map = MainApplication.getMap();
     164                if (map.mapMode instanceof AddNoteAction) {
     165                    map.selectMapMode(map.mapModeSelect);
     166                }
    163167            }
    164168        }
Note: See TracChangeset for help on using the changeset viewer.