diff options
author | Fred Baksik <fdk17@ftml.net> | 2020-07-15 19:03:45 (GMT) |
---|---|---|
committer | Fred Baksik <fred.baksik@mrcy.com> | 2020-07-23 18:52:48 (GMT) |
commit | ec1d3bc0b64550307c23ceae7ef542124b68e2e5 (patch) | |
tree | 09a159004838790b20e17789e67fefbf88eb5f75 | |
parent | 4daff2b40f374a6a36c955f44ccf1c4aa3cc5561 (diff) | |
download | CMake-ec1d3bc0b64550307c23ceae7ef542124b68e2e5.zip CMake-ec1d3bc0b64550307c23ceae7ef542124b68e2e5.tar.gz CMake-ec1d3bc0b64550307c23ceae7ef542124b68e2e5.tar.bz2 |
cmake: avoid exception when printing "changed variables" message
If the changed cache variable was a list then this processing may
attempt to access beyond the last item in the list. Instead skip
printing the non-existing value and backup one to finish the loop.
-rw-r--r-- | Source/cmake.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 45fa44b..aa8298f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1390,8 +1390,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) save.key = *i; warning << *i << "= "; i++; - save.value = *i; - warning << *i << "\n"; + if (i != argsSplit.end()) { + save.value = *i; + warning << *i << "\n"; + } else { + warning << "\n"; + i -= 1; + } cmProp existingValue = this->State->GetCacheEntryValue(save.key); if (existingValue) { save.type = this->State->GetCacheEntryType(save.key); |