Skip to content

Commit 4d2972a

Browse files
committed
tools: fix SrcRemove on empty src
If the src is empty list, it will crash at: IndexError: list index out of range: File "/home/xxx/src/SConstruct", line 39: objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=True) ... File "/home/xxx/src/drivers/SConscript", line 12: SrcRemove(src, src_need_remove) File "/home/rt-thread-stable/tools/building.py", line 496: if type(src[0]) == type('str'): Commit d33df46 in master.
1 parent 8b8d69f commit 4d2972a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/building.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ def EndBuilding(target, program = None):
493493
CscopeDatabase(Projects)
494494

495495
def SrcRemove(src, remove):
496+
if not src:
497+
return
498+
496499
if type(src[0]) == type('str'):
497500
for item in src:
498501
if os.path.basename(item) in remove:

0 commit comments

Comments
 (0)