Skip to content

Commit 7f87574

Browse files
committed
Hardened upload.tool property reading code for boards.txt
Fixes #1464
1 parent 8ab419f commit 7f87574

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/src/processing/app/Editor.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,6 +2433,10 @@ public void run() {
24332433
if (serialMenu.getItemCount() == 0) statusError(e);
24342434
else if (serialPrompt()) run();
24352435
else statusNotice(_("Upload canceled."));
2436+
} catch (PreferencesMapException e) {
2437+
statusError(I18n.format(
2438+
_("Error while uploading: missing '{0}' configuration parameter"),
2439+
e.getMessage()));
24362440
} catch (RunnerException e) {
24372441
//statusError("Error during upload.");
24382442
//e.printStackTrace();
@@ -2469,6 +2473,10 @@ public void run() {
24692473
if (serialMenu.getItemCount() == 0) statusError(e);
24702474
else if (serialPrompt()) run();
24712475
else statusNotice(_("Upload canceled."));
2476+
} catch (PreferencesMapException e) {
2477+
statusError(I18n.format(
2478+
_("Error while uploading: missing '{0}' configuration parameter"),
2479+
e.getMessage()));
24722480
} catch (RunnerException e) {
24732481
//statusError("Error during upload.");
24742482
//e.printStackTrace();

app/src/processing/app/debug/BasicUploader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public boolean uploadUsingPreferences(String buildPath, String className,
5151
TargetPlatform targetPlatform = Base.getTargetPlatform();
5252
PreferencesMap prefs = Preferences.getMap();
5353
prefs.putAll(Base.getBoardPreferences());
54-
prefs.putAll(targetPlatform.getTool(prefs.get("upload.tool")));
54+
prefs.putAll(targetPlatform.getTool(prefs.getOrExcept("upload.tool")));
5555

5656
// if no protocol is specified for this board, assume it lacks a
5757
// bootloader and upload using the selected programmer.

0 commit comments

Comments
 (0)