From 392394086d5109bf0ff09a4eaff99bbbf5c12f21 Mon Sep 17 00:00:00 2001 From: SunXinzhao <1249816318@qq.com> Date: Fri, 8 Jul 2022 16:59:25 +0800 Subject: [PATCH] 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 --- program.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/program.c b/program.c index ea7b706..d1ffed6 100644 --- a/program.c +++ b/program.c @@ -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); }