qdl: Add a fix for read xml error

When xml has no last_sector, qdl will read xml failed. Add check
to see if last_sector exists
This commit is contained in:
SunXinzhao
2022-07-08 16:59:25 +08:00
committed by Bjorn Andersson
parent bdcf93b4a3
commit 392394086d

View File

@@ -97,7 +97,9 @@ static int load_program_tag(xmlNode *node, bool is_nand)
if (is_nand) {
program->pages_per_block = attr_as_unsigned(node, "PAGES_PER_BLOCK", &errors);
program->last_sector = attr_as_unsigned(node, "last_sector", &errors);
if (NULL != xmlGetProp(node, (xmlChar *)"last_sector")) {
program->last_sector = attr_as_unsigned(node, "last_sector", &errors);
}
} else {
program->file_offset = attr_as_unsigned(node, "file_sector_offset", &errors);
}