Commit 70272f3c authored by Laurent Rineau's avatar Laurent Rineau Committed by Brad King
Browse files

server: Fix crash on missing cache entries

Test for nullptr before constructing std::string.
parent f15cfd89
......@@ -284,7 +284,9 @@ static bool testValue(cmState* state, const std::string& key,
std::string& value, const std::string& keyDescription,
std::string* errorMessage)
const std::string cachedValue = std::string(state->GetCacheEntryValue(key));
const char* entry = state->GetCacheEntryValue(key);
const std::string cachedValue =
entry == nullptr ? std::string() : std::string(entry);
if (!cachedValue.empty() && !value.empty() && cachedValue != value) {
setErrorMessage(errorMessage, std::string("\"") + key +
"\" is set but incompatible with configured " +
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment