Take a size check outside of an inner loop.

This commit is contained in:
Stephen Kelly 2015-01-25 15:35:26 +01:00
parent 71d47115d0
commit 74c4d9d27a
2 changed files with 10 additions and 10 deletions

View File

@ -35,15 +35,15 @@ bool cmSetTargetPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
if (std::distance(j, args.end()) % 2 != 0)
{
this->SetError("called with incorrect number of arguments.");
return false;
}
while (j != args.end())
{
propertyPairs.push_back(*j);
++j;
if(j == args.end())
{
this->SetError("called with incorrect number of arguments.");
return false;
}
propertyPairs.push_back(*j);
++j;
}

View File

@ -36,15 +36,15 @@ bool cmSetTestsPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
if (std::distance(j, args.end()) % 2 != 0)
{
this->SetError("called with incorrect number of arguments.");
return false;
}
while (j != args.end())
{
propertyPairs.push_back(*j);
++j;
if(j == args.end())
{
this->SetError("called with incorrect number of arguments.");
return false;
}
propertyPairs.push_back(*j);
++j;
}