summaryrefslogtreecommitdiffstats
path: root/Source/cmListCommand.cxx
diff options
context:
space:
mode:
authorDaniel Chabrowski <dantezstudio@gmail.com>2018-07-01 16:30:21 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-05 17:53:49 (GMT)
commita08154d493a08f1fc1473038f897eb5468a8f79b (patch)
treedc4c47de31730f708d0f95874ca1be97aede81b9 /Source/cmListCommand.cxx
parentdc70284c811a3183295371903d965658a9d2f8e0 (diff)
downloadCMake-a08154d493a08f1fc1473038f897eb5468a8f79b.zip
CMake-a08154d493a08f1fc1473038f897eb5468a8f79b.tar.gz
CMake-a08154d493a08f1fc1473038f897eb5468a8f79b.tar.bz2
list: Allow inserting at the end of a list
Fixes: #18069
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r--Source/cmListCommand.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index ba0c843..d7de2fa 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -289,12 +289,10 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
if (item < 0) {
item = static_cast<int>(nitem) + item;
}
- if (item < 0 || nitem <= static_cast<size_t>(item)) {
+ if (item < 0 || nitem < static_cast<size_t>(item)) {
std::ostringstream str;
str << "index: " << item << " out of range (-" << varArgsExpanded.size()
- << ", "
- << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1))
- << ")";
+ << ", " << varArgsExpanded.size() << ")";
this->SetError(str.str());
return false;
}