diff options
author | Brad King <brad.king@kitware.com> | 2019-04-05 12:51:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-04-05 12:51:25 (GMT) |
commit | ffcb4f7ec5789fb62812b88f3909100a29277e44 (patch) | |
tree | 6afd451745232c91ce13e4be7619492b5d11d3fb /Source | |
parent | 52fb35bd69ec2fa1a5307695cb22c3f125debf4f (diff) | |
parent | a9b38a17571bca0801594adf85fef59fac51d6ba (diff) | |
download | CMake-ffcb4f7ec5789fb62812b88f3909100a29277e44.zip CMake-ffcb4f7ec5789fb62812b88f3909100a29277e44.tar.gz CMake-ffcb4f7ec5789fb62812b88f3909100a29277e44.tar.bz2 |
Merge topic 'rst-bad-markup-block'
a9b38a1757 cmRST: Fix crash on empty markup block
2024327746 Help: Remove empty literal block markup in RESOURCE target property
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3197
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmRST.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index b7216b0..2064275 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -457,6 +457,12 @@ void cmRST::UnindentLines(std::vector<std::string>& lines) size_t trailingEmpty = std::distance(rit, cmFindNot(cmReverseRange(lines), std::string())); + if ((leadingEmpty + trailingEmpty) >= lines.size()) { + // All lines are empty. The markup block is empty. Leave only one. + lines.resize(1); + return; + } + std::vector<std::string>::iterator contentEnd = cmRotate( lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty); lines.erase(contentEnd, lines.end()); |