Skip to content

Commit

Permalink
If opening serial monitor causes an error, set it closed. Fixes esp82…
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Fissore committed Jun 1, 2015
1 parent a859cfb commit b77f5f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2727,6 +2727,11 @@ public void handleSerial() {
errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")";
}
statusError(errorMessage);
try {
serialMonitor.close();
} catch (Exception e1) {
// noop
}
} catch (Exception e) {
statusError(e);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion app/src/processing/app/SerialMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ protected void message(char buff[], int n) {
}

public void close() throws Exception {
super.close();
if (serial != null) {
super.close();
int[] location = getPlacement();
String locationStr = PApplet.join(PApplet.str(location), ",");
PreferencesData.set("last.serial.location", locationStr);
Expand Down

0 comments on commit b77f5f7

Please sign in to comment.