Skip to content

Commit b77f5f7

Browse files
author
Federico Fissore
committed
If opening serial monitor causes an error, set it closed. Fixes #3268
1 parent a859cfb commit b77f5f7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/processing/app/Editor.java

+5
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,11 @@ public void handleSerial() {
27272727
errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")";
27282728
}
27292729
statusError(errorMessage);
2730+
try {
2731+
serialMonitor.close();
2732+
} catch (Exception e1) {
2733+
// noop
2734+
}
27302735
} catch (Exception e) {
27312736
statusError(e);
27322737
} finally {

app/src/processing/app/SerialMonitor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ protected void message(char buff[], int n) {
9999
}
100100

101101
public void close() throws Exception {
102+
super.close();
102103
if (serial != null) {
103-
super.close();
104104
int[] location = getPlacement();
105105
String locationStr = PApplet.join(PApplet.str(location), ",");
106106
PreferencesData.set("last.serial.location", locationStr);

0 commit comments

Comments
 (0)