File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -133,8 +133,13 @@ def collect_stats(kernel_repo, cve_patch):
133
133
134
134
# check which lines of the patch have been added already
135
135
for file in patch_added_lines :
136
+ file_path = kernel_repo + '/' + file
137
+ # just skip nonexisting files
138
+ if not os .path .exists (file_path ):
139
+ continue
140
+
136
141
fp_contents = [line .rstrip ('\n ' ) for line in
137
- open (kernel_repo + '/' + file , 'r' ) if line .strip ()]
142
+ open (file_path , 'r' ) if line .strip ()]
138
143
139
144
# we need this array so we can check the above block
140
145
all_added = []
@@ -181,8 +186,13 @@ def collect_stats(kernel_repo, cve_patch):
181
186
actually_added_lines += len (added )
182
187
183
188
for file in patch_removed_lines :
189
+ file_path = kernel_repo + '/' + file
190
+ # just skip nonexisting files
191
+ if not os .path .exists (file_path ):
192
+ continue
193
+
184
194
fp_contents = [line .rstrip ('\n ' ) for line in
185
- open (kernel_repo + '/' + file , 'r' ) if line .strip ()]
195
+ open (file_path , 'r' ) if line .strip ()]
186
196
187
197
for i in range (0 , len (fp_contents )):
188
198
lines = fp_contents [i :i + 2 ]
You can’t perform that action at this time.
0 commit comments