mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Show a helpful message when no Port is selected
This commit is contained in:
parent
5f9ff25b3c
commit
4ccf9bbd90
@ -709,6 +709,10 @@ public class SketchController {
|
||||
|
||||
UploaderUtils uploaderInstance = new UploaderUtils();
|
||||
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
|
||||
if (uploader == null) {
|
||||
editor.statusError(tr("Please select a Port before Upload"));
|
||||
return false;
|
||||
}
|
||||
|
||||
EditorConsole.setCurrentEditorConsole(editor.console);
|
||||
|
||||
|
@ -50,7 +50,16 @@ public class UploaderUtils {
|
||||
|
||||
BoardPort boardPort = null;
|
||||
if (!noUploadPort) {
|
||||
boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port"));
|
||||
String port = PreferencesData.get("serial.port");
|
||||
if (port == null || port.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
boardPort = BaseNoGui.getDiscoveryManager().find(port);
|
||||
//if (boardPort == null) {
|
||||
// Is there ever a reason to attempt upload when
|
||||
// the Port is not found by DiscoveryManager?
|
||||
//return null;
|
||||
//}
|
||||
}
|
||||
|
||||
return new UploaderFactory().newUploader(target.getBoards().get(board), boardPort, noUploadPort);
|
||||
|
Loading…
x
Reference in New Issue
Block a user