summaryrefslogtreecommitdiffstats
path: root/Source/cmListCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-24 21:13:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-24 21:13:05 (GMT)
commita0471c3fe2e959728a5fd75fb3583e1c8b55ec44 (patch)
tree2b0ef2172be66210a00fffed50dfbbdb5ff7866a /Source/cmListCommand.cxx
parentca5647c92c7500f64d54f65bf6deeb20cec9cbf6 (diff)
downloadCMake-a0471c3fe2e959728a5fd75fb3583e1c8b55ec44.zip
CMake-a0471c3fe2e959728a5fd75fb3583e1c8b55ec44.tar.gz
CMake-a0471c3fe2e959728a5fd75fb3583e1c8b55ec44.tar.bz2
ENH: allow unset vars to be used in list length
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r--Source/cmListCommand.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 6c0b595..a41b5e8 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -106,11 +106,10 @@ bool cmListCommand::HandleLengthCommand(std::vector<std::string> const& args)
const std::string& listName = args[1];
const std::string& variableName = args[args.size() - 1];
std::vector<std::string> varArgsExpanded;
- if ( !this->GetList(varArgsExpanded, listName.c_str()) )
- {
- return false;
- }
-
+ // do not check the return value here
+ // if the list var is not found varArgsExpanded will have size 0
+ // and we will return 0
+ this->GetList(varArgsExpanded, listName.c_str());
size_t length = varArgsExpanded.size();
char buffer[1024];
sprintf(buffer, "%d", static_cast<int>(length));