Check if the environment variable TERM is defined before using it.

This fixes: <rdar://problem/6164279> scan-build gives error when invoked without TERM variable

llvm-svn: 56110
This commit is contained in:
Ted Kremenek 2008-09-11 18:17:51 +00:00
parent c4488441da
commit 81ced5c472
1 changed files with 3 additions and 2 deletions

View File

@ -26,8 +26,9 @@ my $BuildName;
my $BuildDate;
my $CXX; # Leave undefined initially.
my $UseColor = ((($ENV{'TERM'} eq 'xterm-color') and -t STDOUT)
and defined($ENV{'SCAN_BUILD_COLOR'}));
my $TERM = $ENV{'TERM'};
my $UseColor = (defined $TERM and $TERM eq 'xterm-color' and -t STDOUT
and defined $ENV{'SCAN_BUILD_COLOR'});
##----------------------------------------------------------------------------##
# Diagnostics