Fix crash on unset environment variable.

This commit is contained in:
Stephan Roslen 2020-10-15 21:17:26 +02:00 committed by Arthur Sonzogni
parent 606e0efdfe
commit e34dc1606e

View File

@ -36,7 +36,11 @@ Terminal::Dimensions Terminal::Size() {
} }
bool Terminal::CanSupportTrueColors() { bool Terminal::CanSupportTrueColors() {
std::string COLORTERM = std::getenv("COLORTERM"); char *COLORTERM_RAW = std::getenv("COLORTERM");
if (nullptr == COLORTERM_RAW) {
return false;
}
std::string COLORTERM = COLORTERM_RAW;
return COLORTERM.compare("24bit") || COLORTERM.compare("trueColor"); return COLORTERM.compare("24bit") || COLORTERM.compare("trueColor");
} }