main: raise error when board name is provided but not found

This commit is contained in:
Gwenhael Goavec-Merou 2021-11-11 17:20:51 +01:00
parent 3b15a633fa
commit 8df01663ff
1 changed files with 7 additions and 2 deletions

View File

@ -97,8 +97,13 @@ int main(int argc, char **argv)
if (args.prg_type == Device::WR_FLASH)
cout << "write to flash" << endl;
if (args.board[0] != '-' && board_list.find(args.board) != board_list.end()) {
board = &(board_list[args.board]);
if (args.board[0] != '-') {
if (board_list.find(args.board) != board_list.end()) {
board = &(board_list[args.board]);
} else {
printError("Error: cannot find board \'" +args.board + "\'");
return EXIT_FAILURE;
}
}
/* if a board name is specified try to use this to determine cable */