Take a size check outside of an inner loop.
This commit is contained in:
parent
71d47115d0
commit
74c4d9d27a
|
@ -35,15 +35,15 @@ bool cmSetTargetPropertiesCommand
|
||||||
doingFiles = false;
|
doingFiles = false;
|
||||||
// now loop through the rest of the arguments, new style
|
// now loop through the rest of the arguments, new style
|
||||||
++j;
|
++j;
|
||||||
|
if (std::distance(j, args.end()) % 2 != 0)
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while (j != args.end())
|
while (j != args.end())
|
||||||
{
|
{
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
++j;
|
++j;
|
||||||
if(j == args.end())
|
|
||||||
{
|
|
||||||
this->SetError("called with incorrect number of arguments.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,15 +36,15 @@ bool cmSetTestsPropertiesCommand
|
||||||
doingFiles = false;
|
doingFiles = false;
|
||||||
// now loop through the rest of the arguments, new style
|
// now loop through the rest of the arguments, new style
|
||||||
++j;
|
++j;
|
||||||
|
if (std::distance(j, args.end()) % 2 != 0)
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while (j != args.end())
|
while (j != args.end())
|
||||||
{
|
{
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
++j;
|
++j;
|
||||||
if(j == args.end())
|
|
||||||
{
|
|
||||||
this->SetError("called with incorrect number of arguments.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue