summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-04-19 13:33:29 (GMT)
committerBrad King <brad.king@kitware.com>2012-04-19 13:33:29 (GMT)
commit8787f946b73315d84649bd9818a8225a772c7c36 (patch)
tree77d1a25c564619c591221476fabed173ecca7215 /Source
parent4a30258d91818eb1c1d6741b5a47c54cbfab3313 (diff)
parent05604eb9cb7ced290af67dcc392f0a9a10e64386 (diff)
downloadCMake-8787f946b73315d84649bd9818a8225a772c7c36.zip
CMake-8787f946b73315d84649bd9818a8225a772c7c36.tar.gz
CMake-8787f946b73315d84649bd9818a8225a772c7c36.tar.bz2
Merge branch 'list-empty-error' into enhance-include_external_msproject
Resolve conflict in Tests/RunCMake/CMakeLists.txt by adding both tests.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmListCommand.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index cbbcbb0..908f3b0 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -204,6 +204,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
this->Makefile->AddDefinition(variableName.c_str(), "NOTFOUND");
return true;
}
+ // FIXME: Add policy to make non-existing lists an error like empty lists.
+ if(varArgsExpanded.empty())
+ {
+ this->SetError("GET given empty list");
+ return false;
+ }
std::string value;
size_t cc;
@@ -318,7 +324,8 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
// expand the variable
int item = atoi(args[2].c_str());
std::vector<std::string> varArgsExpanded;
- if ( !this->GetList(varArgsExpanded, listName.c_str()) && item != 0)
+ if((!this->GetList(varArgsExpanded, listName.c_str())
+ || varArgsExpanded.empty()) && item != 0)
{
cmOStringStream str;
str << "index: " << item << " out of range (0, 0)";
@@ -544,6 +551,12 @@ bool cmListCommand::HandleRemoveAtCommand(
this->SetError("sub-command REMOVE_AT requires list to be present.");
return false;
}
+ // FIXME: Add policy to make non-existing lists an error like empty lists.
+ if(varArgsExpanded.empty())
+ {
+ this->SetError("REMOVE_AT given empty list");
+ return false;
+ }
size_t cc;
std::vector<size_t> removed;