fix: check for valid buffer handles in modify_keymap (#13543)

Fixes #13541
Neovim would crash when trying to map a key on non existant buffer
This commit is contained in:
Thomas Vigouroux
2021-01-03 19:14:18 +01:00
committed by GitHub
parent ae63dc264a
commit fd960a33e4
2 changed files with 9 additions and 0 deletions

View File

@@ -820,6 +820,10 @@ void modify_keymap(Buffer buffer, bool is_unmap, String mode, String lhs,
}
buf_T *target_buf = find_buffer_by_handle(buffer, err);
if (!target_buf) {
return;
}
MapArguments parsed_args;
memset(&parsed_args, 0, sizeof(parsed_args));
if (parse_keymap_opts(opts, &parsed_args, err)) {