diff --git a/src/input.cpp b/src/input.cpp index 94b4f9cde..6e20d4c4b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -544,10 +544,11 @@ std::vector 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::iterator it = ml.begin(), end = ml.end(); - it != end; ++it) { + for (std::vector::iterator it = ml.begin(); it != ml.end();) { if (mode == NULL || mode == it->mode) { - ml.erase(it); + it = ml.erase(it); + } else { + ++it; } } }