diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 12a63b0028..aa39c39a5a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -406,11 +406,12 @@ bool cmSystemTools::IsNOTFOUND(const char* val) bool cmSystemTools::IsOff(const char* val) { - if (!val || strlen(val) == 0) + if (!val || !*val) { return true; } - std::basic_string v = val; + size_t len = val ? strlen(val) : 0; + std::basic_string v(val, len); for(std::basic_string::iterator c = v.begin(); c != v.end(); c++)