浏览代码

Merge topic 'server-fix-crash'

70272f3c server: Fix crash on missing cache entries

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1096
Brad King 8 年之前
父节点
当前提交
ee79d7a130
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Source/cmServerProtocol.cxx

+ 3 - 1
Source/cmServerProtocol.cxx

@@ -289,7 +289,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 " +