From 978c8fc68281d617620e35d84acc9f08c3f12702 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 22 Jun 2015 11:11:09 +0200 Subject: [PATCH] Compiler: don't merge if bootloader file is specified but missing. Print a warning instead. Fixes #3394 --- arduino-core/src/processing/app/debug/Compiler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arduino-core/src/processing/app/debug/Compiler.java b/arduino-core/src/processing/app/debug/Compiler.java index 42393add1..e6a098c40 100644 --- a/arduino-core/src/processing/app/debug/Compiler.java +++ b/arduino-core/src/processing/app/debug/Compiler.java @@ -1198,15 +1198,19 @@ public class Compiler implements MessageConsumer { return null; } - File mergedSketch = new File(buildPath, className + ".with_bootloader.hex"); - FileUtils.copyFile(sketch, mergedSketch); - String bootloaderNoBlink = prefs.get("bootloader.noblink"); if (bootloaderNoBlink == null) { bootloaderNoBlink = prefs.get("bootloader.file"); } File bootloader = new File(new File(prefs.get("build.platform.path"), "bootloaders"), bootloaderNoBlink); + if (!bootloader.exists()) { + System.err.println(I18n.format(_("Bootloader file specified but missing: {0}"), bootloader)); + return null; + } + + File mergedSketch = new File(buildPath, className + ".with_bootloader.hex"); + FileUtils.copyFile(sketch, mergedSketch); new MergeSketchWithBooloader().merge(mergedSketch, bootloader);