TAPAAL / tapaal-gui

TAPAAL is a tool for verification of Timed-Arc Petri Nets developed at Department of Computer Science at Aalborg University.
https://www.tapaal.net
3 stars 11 forks source link

Fixed annotation NPE #141

Closed mtygesen closed 7 months ago

mtygesen commented 7 months ago

Fixes NPE when creating a new annotation and trying to close it immediately.

yrke commented 7 months ago

I think you are right the code can be removed, but it will make it so two undo events are added to the stack when a new note is added: I suggest removed the snippet in this code + changing to something like the following:

        if (!newText.equals(oldText) && !isFirstEdit) {
            // Text has been changed

            TAPAALGUI.getCurrentTab().getUndoManager().addNewEdit(
                    new AnnotationTextEditCommand(this, oldText, newText)
            );
            updateBounds();
            return true;
        } else if (isFirstEdit && !newText.isBlank()) {
            return true;
        }

in function enableEditMode around line 200. This way we are not adding a NewAnnotionCommand + a edit annotaion command.

see addAnnotationNote(DataLayer c, Point p) { in GuiModelManager for where annotation is added.

mtygesen commented 7 months ago

The redo/undo stack should now be working correctly