mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Check for nulls when using programmer
Try to test and gracefully fail rather than throwing a NullPointerException. See #10032 for an example of this exception being thrown.
This commit is contained in:
parent
a1e43ce490
commit
08ea1cc481
@ -280,12 +280,18 @@ public class SerialUploader extends Uploader {
|
||||
private boolean uploadUsingProgrammer(String buildPath, String className) throws Exception {
|
||||
|
||||
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
|
||||
if (targetPlatform == null) {
|
||||
throw new RunnerException(tr("Gould not load platform for programmer. Ensure programmer selection is correct for the board."), false);
|
||||
}
|
||||
String programmer = PreferencesData.get("programmer");
|
||||
if (programmer.contains(":")) {
|
||||
String[] split = programmer.split(":", 2);
|
||||
targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
|
||||
programmer = split[1];
|
||||
}
|
||||
if (programmer == null) {
|
||||
throw new RunnerException(tr("Gould not load programmer. Ensure programmer selection is correct for the board."), false);
|
||||
}
|
||||
|
||||
PreferencesMap prefs = PreferencesData.getMap();
|
||||
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
|
||||
|
Loading…
x
Reference in New Issue
Block a user