Changeset 18009 in josm for trunk/src/org


Ignore:
Timestamp:
2021-07-13T00:27:59+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #20860 - make sure to not try to close a note when none is selected

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/NoteData.java

    r17836 r18009  
    224224            Logging.debug("closing note {0} with comment: {1}", note.getId(), text);
    225225        }
    226         NoteComment comment = new NoteComment(Instant.now(), getCurrentUser(), text, NoteComment.Action.CLOSED, true);
    227         note.addComment(comment);
     226        Instant now = Instant.now();
     227        note.addComment(new NoteComment(now, getCurrentUser(), text, NoteComment.Action.CLOSED, true));
    228228        note.setState(State.CLOSED);
    229         note.setClosedAt(Instant.now());
     229        note.setClosedAt(now);
    230230        dataUpdated();
    231231    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java

    r17855 r18009  
    404404            }
    405405            Note note = displayList.getSelectedValue();
    406             int selectedIndex = displayList.getSelectedIndex();
    407             noteData.closeNote(note, dialog.getInputText());
    408             noteData.setSelectedNote(model.getElementAt(selectedIndex));
     406            if (note != null) {
     407                int selectedIndex = displayList.getSelectedIndex();
     408                noteData.closeNote(note, dialog.getInputText());
     409                noteData.setSelectedNote(model.getElementAt(selectedIndex));
     410            }
    409411        }
    410412    }
Note: See TracChangeset for help on using the changeset viewer.