summaryrefslogtreecommitdiffstats
path: root/Source/cmServerProtocol.cxx
diff options
context:
space:
mode:
authorJustin Goshi <jgoshi@microsoft.com>2018-01-19 01:35:15 (GMT)
committerJustin Goshi <jgoshi@microsoft.com>2018-01-19 04:54:02 (GMT)
commit33802b316855b69f2a542574caa4dd2fbe569b11 (patch)
tree61764050ee164612357ea2e496ce85c7988846bb /Source/cmServerProtocol.cxx
parentcbe7314bb0f0ce5dbc7a5a9d71f3688c810cf731 (diff)
downloadCMake-33802b316855b69f2a542574caa4dd2fbe569b11.zip
CMake-33802b316855b69f2a542574caa4dd2fbe569b11.tar.gz
CMake-33802b316855b69f2a542574caa4dd2fbe569b11.tar.bz2
server: fix crash if no min version specified
If a CMakeLists.txt file doesn't contain cmake_minimum_required then the server was crashing. The root cause was the json object model does not support null and was crashing. Add the null check and use an empty string in this case.
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r--Source/cmServerProtocol.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 6b7143b..4c0a354 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -1034,8 +1034,8 @@ static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
// Project structure information:
const cmMakefile* mf = lg->GetMakefile();
- pObj[kMINIMUM_CMAKE_VERSION] =
- mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
+ auto minVersion = mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
+ pObj[kMINIMUM_CMAKE_VERSION] = minVersion ? minVersion : "";
pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory();
pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory();
pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config);