Skip to content

Commit 6a48e71

Browse files
committed
added exception for incorrect board name string
Signed-off-by: Catherine Holloway <[email protected]>
1 parent 80849e7 commit 6a48e71

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/arduino.cc/builder/constants/constants.go

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ const MSG_BOARD_UNKNOWN = "Board {0} (platform {1}, package {2}) is unknown"
211211
const MSG_BOOTLOADER_FILE_MISSING = "Bootloader file specified but missing: {0}"
212212
const MSG_BUILD_OPTIONS_CHANGED = "Build options changed, rebuilding all"
213213
const MSG_CANT_FIND_SKETCH_IN_PATH = "Unable to find {0} in {1}"
214+
const MSG_FQBN_INVALID = "{0} is not a valid fully qualified board name. Required format is targetPackageName:targetPlatformName:targetBoardName."
214215
const MSG_INVALID_QUOTING = "Invalid quoting: no closing [{0}] char found."
215216
const MSG_LIB_LEGACY = "(legacy)"
216217
const MSG_LIBRARIES_MULTIPLE_LIBS_FOUND_FOR = "Multiple libraries were found for \"{0}\""

src/arduino.cc/builder/target_board_resolver.go

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func (s *TargetBoardResolver) Run(context map[string]interface{}) error {
4242
fqbn := context[constants.CTX_FQBN].(string)
4343

4444
fqbnParts := strings.Split(fqbn, ":")
45+
if len(fqbnParts) < 3 {
46+
return utils.Errorf(context, constants.MSG_FQBN_INVALID, fqbn)
47+
}
4548
targetPackageName := fqbnParts[0]
4649
targetPlatformName := fqbnParts[1]
4750
targetBoardName := fqbnParts[2]

0 commit comments

Comments
 (0)