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:
ridiculousfish 2018-09-30 17:59:49 -04:00
parent 35ce95f51d
commit 05d14f24d6

View file

@ -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;
}
}
}