mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Providing error messages when no board is selected.
This commit is contained in:
@ -1520,7 +1520,13 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
static public Map<String, String> getBoardPreferences() {
|
static public Map<String, String> getBoardPreferences() {
|
||||||
return getTarget().getBoards().get(Preferences.get("board"));
|
Target target = getTarget();
|
||||||
|
if (target == null) return new LinkedHashMap();
|
||||||
|
Map map = target.getBoards();
|
||||||
|
if (map == null) return new LinkedHashMap();
|
||||||
|
map = (Map) map.get(Preferences.get("board"));
|
||||||
|
if (map == null) return new LinkedHashMap();
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1574,7 +1574,9 @@ public class Sketch {
|
|||||||
protected void size(String buildPath, String suggestedClassName)
|
protected void size(String buildPath, String suggestedClassName)
|
||||||
throws RunnerException {
|
throws RunnerException {
|
||||||
long size = 0;
|
long size = 0;
|
||||||
long maxsize = Integer.parseInt(Base.getBoardPreferences().get("upload.maximum_size"));
|
String maxsizeString = Base.getBoardPreferences().get("upload.maximum_size");
|
||||||
|
if (maxsizeString == null) return;
|
||||||
|
long maxsize = Integer.parseInt(maxsizeString);
|
||||||
Sizer sizer = new Sizer(buildPath, suggestedClassName);
|
Sizer sizer = new Sizer(buildPath, suggestedClassName);
|
||||||
try {
|
try {
|
||||||
size = sizer.computeSize();
|
size = sizer.computeSize();
|
||||||
|
@ -73,6 +73,11 @@ public class Compiler implements MessageConsumer {
|
|||||||
String avrBasePath = Base.getAvrBasePath();
|
String avrBasePath = Base.getAvrBasePath();
|
||||||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||||
String core = boardPreferences.get("build.core");
|
String core = boardPreferences.get("build.core");
|
||||||
|
if (core == null) {
|
||||||
|
RunnerException re = new RunnerException("No board selected; please choose a board from the Tools > Board menu.");
|
||||||
|
re.hideStackTrace();
|
||||||
|
throw re;
|
||||||
|
}
|
||||||
String corePath;
|
String corePath;
|
||||||
|
|
||||||
if (core.indexOf(':') == -1) {
|
if (core.indexOf(':') == -1) {
|
||||||
|
Reference in New Issue
Block a user