Skip to content

Commit f183579

Browse files
Shigeru KANEMOTOFederico Fissore
authored andcommitted
Fix: Exception if type ESC for close confirmation.
If you type an Escape key if a close econfirmation dialog is prompted for unsaved file, an exception thrown. This behavior fixed.
1 parent 2fde40f commit f183579

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

app/src/processing/app/Editor.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,16 +2043,15 @@ protected boolean checkModified() {
20432043
JOptionPane.YES_NO_CANCEL_OPTION,
20442044
JOptionPane.QUESTION_MESSAGE);
20452045

2046-
if (result == JOptionPane.YES_OPTION) {
2046+
switch (result) {
2047+
case JOptionPane.YES_OPTION:
20472048
return handleSave(true);
2048-
2049-
} else if (result == JOptionPane.NO_OPTION) {
2049+
case JOptionPane.NO_OPTION:
20502050
return true; // ok to continue
2051-
2052-
} else if (result == JOptionPane.CANCEL_OPTION) {
2053-
return false;
2054-
2055-
} else {
2051+
case JOptionPane.CANCEL_OPTION:
2052+
case JOptionPane.CLOSED_OPTION: // Escape key pressed
2053+
return false;
2054+
default:
20562055
throw new IllegalStateException();
20572056
}
20582057

0 commit comments

Comments
 (0)