Skip to content

Commit a853372

Browse files
author
Federico Fissore
committed
Compiler: fixed wrong check against non existent folder and a possible NPE
1 parent e097439 commit a853372

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: arduino-core/src/processing/app/debug/Compiler.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ protected void size(PreferencesMap prefs) throws RunnerException {
359359
*/
360360
public boolean compile(boolean _verbose, boolean _save) throws RunnerException, PreferencesMapException {
361361
File sketchBuildFolder = new File(prefs.get("build.path"), "sketch");
362-
if (!sketchBuildFolder.mkdirs()) {
362+
if (!sketchBuildFolder.exists() && !sketchBuildFolder.mkdirs()) {
363363
throw new RunnerException("Unable to create folder " + sketchBuildFolder);
364364
}
365365
preprocess(sketchBuildFolder.getAbsolutePath());
@@ -489,6 +489,9 @@ public boolean compile(boolean _verbose, boolean _save) throws RunnerException,
489489
}
490490

491491
private void adviseDuplicateLibraries() {
492+
if (importedDuplicateHeaders == null) {
493+
return;
494+
}
492495
for (int i=0; i < importedDuplicateHeaders.size(); i++) {
493496
System.out.println(I18n.format(_("Multiple libraries were found for \"{0}\""),
494497
importedDuplicateHeaders.get(i)));

0 commit comments

Comments
 (0)