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.
This commit is contained in:
Fred Baksik 2020-07-15 15:03:45 -04:00 committed by Fred Baksik
parent 4daff2b40f
commit ec1d3bc0b6

View File

@ -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);