From ec1d3bc0b64550307c23ceae7ef542124b68e2e5 Mon Sep 17 00:00:00 2001 From: Fred Baksik Date: Wed, 15 Jul 2020 15:03:45 -0400 Subject: 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. --- Source/cmake.cxx | 9 +++++++-- 1 file 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); -- cgit v0.12