diff options
author | Brad King <brad.king@kitware.com> | 2019-05-15 13:19:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-15 13:19:43 (GMT) |
commit | ac0411f1662f64fe1320e22e5a8906b8a40d6677 (patch) | |
tree | 790251ebc3a382247f890fa40ca3db0297d5b761 | |
parent | 7063ed271e5343adafa485e82614f844a8e31d24 (diff) | |
parent | dfa24355eacbf99cf98bbf4027b8188c13ac7154 (diff) | |
download | CMake-ac0411f1662f64fe1320e22e5a8906b8a40d6677.zip CMake-ac0411f1662f64fe1320e22e5a8906b8a40d6677.tar.gz CMake-ac0411f1662f64fe1320e22e5a8906b8a40d6677.tar.bz2 |
Merge topic 'cmuvprocesschain-iterator-fix'
dfa24355ea cmUVProcessChain: Add assert() for static analysis tools
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3322
-rw-r--r-- | Source/cmUVProcessChain.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index c4e30d4..90ece0b 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -8,6 +8,8 @@ #include "cmUVStreambuf.h" #include "cm_uv.h" +#include <assert.h> + #include <iterator> #include <memory> #include <utility> @@ -250,7 +252,8 @@ bool cmUVProcessChain::InternalData::AddCommand( if (first) { stdio[0].flags = UV_IGNORE; } else { - auto& prev = **std::prev(this->Processes.end(), 2); + assert(this->Processes.size() >= 2); + auto& prev = *this->Processes[this->Processes.size() - 2]; stdio[0].flags = UV_INHERIT_STREAM; stdio[0].data.stream = prev.OutputPipe; } |