2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

color_gcc: Check that cmd has elements in it before processing it.

This commit is contained in:
Erik Parker 2021-06-21 13:45:26 -05:00 committed by Thomas Nagy
parent 9a60e7ed9e
commit 45bc50e523

View File

@ -19,7 +19,7 @@ class ColorGCCFormatter(Logs.formatter):
func = frame.f_code.co_name
if func == 'exec_command':
cmd = frame.f_locals.get('cmd')
if isinstance(cmd, list) and ('gcc' in cmd[0] or 'g++' in cmd[0]):
if isinstance(cmd, list) and (len(cmd) > 0) and ('gcc' in cmd[0] or 'g++' in cmd[0]):
lines = []
for line in rec.msg.splitlines():
if 'warning: ' in line: