If opening serial monitor causes an error, set it closed. Fixes #3268

This commit is contained in:
Federico Fissore 2015-06-01 15:27:12 +02:00
parent a859cfb9f9
commit b77f5f731d
2 changed files with 6 additions and 1 deletions

View File

@ -2727,6 +2727,11 @@ public class Editor extends JFrame implements RunnerListener {
errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")"; errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")";
} }
statusError(errorMessage); statusError(errorMessage);
try {
serialMonitor.close();
} catch (Exception e1) {
// noop
}
} catch (Exception e) { } catch (Exception e) {
statusError(e); statusError(e);
} finally { } finally {

View File

@ -99,8 +99,8 @@ public class SerialMonitor extends AbstractMonitor {
} }
public void close() throws Exception { public void close() throws Exception {
if (serial != null) {
super.close(); super.close();
if (serial != null) {
int[] location = getPlacement(); int[] location = getPlacement();
String locationStr = PApplet.join(PApplet.str(location), ","); String locationStr = PApplet.join(PApplet.str(location), ",");
PreferencesData.set("last.serial.location", locationStr); PreferencesData.set("last.serial.location", locationStr);