diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index f1d9d9f7d..a431a19d7 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -1122,7 +1122,9 @@ public class BaseNoGui { public static void selectSerialPort(String port) { PreferencesData.set("serial.port", port); BoardPort boardPort = getDiscoveryManager().find(port, true); - PreferencesData.set("serial.port.iserial", boardPort.getPrefs().get("iserial")); + if (boardPort != null) { + PreferencesData.set("serial.port.iserial", boardPort.getPrefs().get("iserial")); + } String portFile = port; if (port.startsWith("/dev/")) { portFile = portFile.substring(5);