mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-30 07:01:22 -03: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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user