mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-04-01 17:35:13 +08:00
Fix a crash in bind
444f9f87154fd3970f11a1bcb8bafee48d2afa76 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
@ -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…
x
Reference in New Issue
Block a user