diff --git a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java index 96ba383aceb..98f34baf173 100644 --- a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java +++ b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java @@ -280,12 +280,18 @@ private String waitForUploadPort(String uploadPort, List before, boolean private boolean uploadUsingProgrammer(String buildPath, String className) throws Exception { TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform(); + if (targetPlatform == null) { + throw new RunnerException(tr("Could 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("Could not load programmer. Ensure programmer selection is correct for the board."), false); + } PreferencesMap prefs = PreferencesData.getMap(); PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();