From 8df01663ff98f1375dde245b80ca740544037230 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Thu, 11 Nov 2021 17:20:51 +0100 Subject: [PATCH] main: raise error when board name is provided but not found --- src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5fb5ca0..f672553 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 */