mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Fix a crash in bind
444f9f8715
introduced a bug where we would
use an iterator that had been invalidated by erase(). Fix that.
This commit is contained in:
parent
35ce95f51d
commit
05d14f24d6
1 changed files with 4 additions and 3 deletions
|
@ -544,10 +544,11 @@ std::vector<input_mapping_name_t> input_mapping_get_names(bool user) {
|
|||
|
||||
void input_mapping_clear(const wchar_t *mode, bool user) {
|
||||
auto& ml = user ? mapping_list : preset_mapping_list;
|
||||
for (std::vector<input_mapping_t>::iterator it = ml.begin(), end = ml.end();
|
||||
it != end; ++it) {
|
||||
for (std::vector<input_mapping_t>::iterator it = ml.begin(); it != ml.end();) {
|
||||
if (mode == NULL || mode == it->mode) {
|
||||
ml.erase(it);
|
||||
it = ml.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue