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
parent f44e4592a7
commit e65bd769f3
1 changed files with 1 additions and 1 deletions

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: