Ver Fonte

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.
Fred Baksik há 5 anos atrás
pai
commit
ec1d3bc0b6
1 ficheiros alterados com 7 adições e 2 exclusões
  1. 7 2
      Source/cmake.cxx

+ 7 - 2
Source/cmake.cxx

@@ -1390,8 +1390,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
     save.key = *i;
     save.key = *i;
     warning << *i << "= ";
     warning << *i << "= ";
     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);
     cmProp existingValue = this->State->GetCacheEntryValue(save.key);
     if (existingValue) {
     if (existingValue) {
       save.type = this->State->GetCacheEntryType(save.key);
       save.type = this->State->GetCacheEntryType(save.key);