From 6c4efc050974812d6ebee1cea711e3c81e4e4442 Mon Sep 17 00:00:00 2001 From: Mingyue Liang Date: Fri, 13 Nov 2020 15:33:01 +0800 Subject: BaseTools: Resolve index out of range errors. This problem is generated by solving bz2972's patch, and the commit ID is 0af7f8e6a9253960ba820cd6ddfd8c36543d30cb. This is a problem when updating the DEPs file. The code does not consider that there is only one line of content in the file, so the filter condition is added to prevent the index from exceeding the range. Signed-off-by: Mingyue Liang Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Reviewed-by: Yuwei Chen Reviewed-by: Bob Feng Reviewed-by: Liming Gao --- BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'BaseTools') diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py index b06ef42573..5ec26eb98b 100644 --- a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py @@ -291,7 +291,8 @@ ${END} targetitem = self.GetRealTarget(source_abs.strip(" :")) targetitem += ": " - targetitem += lines[1] + if len(lines)>=2: + targetitem += lines[1] newcontent.append(targetitem) newcontent.extend(lines[2:]) newcontent.append("\n") -- cgit v1.2.3