From 1d1c3a18bd93730f97eff5869ac1516136ec64da Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Sun, 3 Jul 2016 02:36:30 -0700 Subject: [PATCH] Added a null check to TERM_PROGRAM environment variable check. --- src/musikbox/cursespp/Colors.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/musikbox/cursespp/Colors.cpp b/src/musikbox/cursespp/Colors.cpp index 8bd167ff3..bfa2271c6 100755 --- a/src/musikbox/cursespp/Colors.cpp +++ b/src/musikbox/cursespp/Colors.cpp @@ -77,7 +77,11 @@ static bool customColorsSupported() { #ifdef WIN32 return true; #else - std::string term = std::string(std::getenv("TERM_PROGRAM")); + const char* termEnv = std::getenv("TERM_PROGRAM"); + std::string term; + if (termEnv && strlen(termEnv)) { + term = std::string(termEnv); + } return term != "Apple_Terminal"; #endif }