]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Resolve index out of range errors.
authorMingyue Liang <mingyuex.liang@intel.com>
Fri, 13 Nov 2020 07:33:01 +0000 (15:33 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 19 Nov 2020 02:22:57 +0000 (02:22 +0000)
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 <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
BaseTools/Source/Python/AutoGen/IncludesAutoGen.py

index b06ef42573fd5c5419b490a9045fc23da5a07052..5ec26eb98b428dc8dfdc92d0d6f2e814c7b20980 100644 (file)
@@ -291,7 +291,8 @@ ${END}
                 targetitem = self.GetRealTarget(source_abs.strip(" :"))\r
 \r
                 targetitem += ": "\r
-                targetitem += lines[1]\r
+                if len(lines)>=2:\r
+                    targetitem += lines[1]\r
                 newcontent.append(targetitem)\r
                 newcontent.extend(lines[2:])\r
                 newcontent.append("\n")\r