|
26 | 26 |
|
27 | 27 | package cc.arduino.packages.uploaders;
|
28 | 28 |
|
29 |
| -import cc.arduino.packages.Uploader; |
30 |
| -import processing.app.*; |
31 |
| -import processing.app.debug.RunnerException; |
32 |
| -import processing.app.debug.TargetPlatform; |
33 |
| -import processing.app.helpers.PreferencesMap; |
34 |
| -import processing.app.helpers.StringReplacer; |
| 29 | +import static processing.app.I18n._; |
35 | 30 |
|
36 | 31 | import java.io.File;
|
37 | 32 | import java.util.ArrayList;
|
38 | 33 | import java.util.List;
|
39 | 34 |
|
40 |
| -import static processing.app.I18n._; |
| 35 | +import processing.app.Base; |
| 36 | +import processing.app.I18n; |
| 37 | +import processing.app.Preferences; |
| 38 | +import processing.app.Serial; |
| 39 | +import processing.app.SerialException; |
| 40 | +import processing.app.debug.RunnerException; |
| 41 | +import processing.app.debug.TargetPlatform; |
| 42 | +import processing.app.helpers.PreferencesMap; |
| 43 | +import processing.app.helpers.StringReplacer; |
| 44 | +import cc.arduino.packages.Uploader; |
41 | 45 |
|
42 | 46 | public class SerialUploader extends Uploader {
|
43 | 47 |
|
@@ -209,7 +213,11 @@ public boolean uploadUsingProgrammer(String buildPath, String className) throws
|
209 | 213 |
|
210 | 214 | PreferencesMap prefs = Preferences.getMap();
|
211 | 215 | prefs.putAll(Base.getBoardPreferences());
|
212 |
| - prefs.putAll(targetPlatform.getProgrammer(programmer)); |
| 216 | + PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer); |
| 217 | + if (programmerPrefs == null) |
| 218 | + throw new RunnerException( |
| 219 | + _("Please select a programmer from Tools->Programmer menu")); |
| 220 | + prefs.putAll(programmerPrefs); |
213 | 221 | prefs.putAll(targetPlatform.getTool(prefs.getOrExcept("program.tool")));
|
214 | 222 |
|
215 | 223 | prefs.put("build.path", buildPath);
|
@@ -251,6 +259,9 @@ public boolean burnBootloader() throws Exception {
|
251 | 259 | } else {
|
252 | 260 | programmerPrefs = targetPlatform.getProgrammer(programmer);
|
253 | 261 | }
|
| 262 | + if (programmerPrefs == null) |
| 263 | + throw new RunnerException( |
| 264 | + _("Please select a programmer from Tools->Programmer menu")); |
254 | 265 |
|
255 | 266 | // Build configuration for the current programmer
|
256 | 267 | PreferencesMap prefs = Preferences.getMap();
|
|
0 commit comments