-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Check for nulls when using programmer #10033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,12 +280,18 @@ private String waitForUploadPort(String uploadPort, List<String> before, boolean | |
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]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could again return null when an invalid package is specified in the "programmer". Or does this throw an exception instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As in the other comment. Trying to be defensive AND give a unique error message for future users who ask for support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused. I think this can return |
||
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(); | ||
|