Skip to content

Commit 2a677b4

Browse files
committed
avoid NPE if serial port gets discovered too early
1 parent 7e17b5c commit 2a677b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
154154
}
155155

156156
BoardPort boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port"));
157-
if (boardPort.getPrefs().get("iserial") != null) {
157+
try {
158158
prefs.put("serial.port.iserial", boardPort.getPrefs().get("iserial"));
159+
} catch (Exception e) {
160+
// if serial port does not contain an iserial field
159161
}
160162

161163
prefs.put("build.path", buildPath);

0 commit comments

Comments
 (0)