config_tools: gracefully process board XMLs with non-standard info

Occasionally the regular expressions searching for manufacturer and product
name of the target board fail to find a matching line in a given board XML,
possibly because the board XML does not contain such info. This causes an
alert to be raised while it does not impact the functionality of the
configurator.

This patch adds a check to suppress such alerts.

Tracked-On: #6691
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-05-18 13:46:26 +08:00 committed by acrnsi-robot
parent 22a47fe795
commit c4f46d9c28

View File

@ -145,11 +145,11 @@ export default {
let reg = /(?<=Manufacturer).+(?=\\n)/
let result = boardContent.match(/Manufacturer.+\n/gm)
console.log(result)
if (result.length > 0) {
if (result && result.length > 0) {
this.currentBoardManu = result[0]
}
var result_p = boardContent.match(/Product Name.+\n/gm)
if (result_p.length > 0) {
if (result_p && result_p.length > 0) {
this.CurrentBoardProd = result_p[0]
}
},