mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-25 01:28:50 -05:00
Merge topic 'findbase_dont_erase_outofbounds_entry'
f5837f0ac9 cmFindBase: Don't pass vector::erase an out of bounds iterator
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10331
This commit is contained in:
@@ -356,14 +356,16 @@ struct entry_to_remove
|
||||
{
|
||||
if (this->valid()) {
|
||||
long to_skip = this->count;
|
||||
long index_to_remove = 0;
|
||||
size_t index_to_remove = 0;
|
||||
for (auto const& path : entries) {
|
||||
if (path == this->value && --to_skip == 0) {
|
||||
break;
|
||||
}
|
||||
++index_to_remove;
|
||||
}
|
||||
entries.erase(entries.begin() + index_to_remove);
|
||||
if (index_to_remove < entries.size() && to_skip == 0) {
|
||||
entries.erase(entries.begin() + index_to_remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user